From 873f177f08dc7c4fe2d7e50bbe7709df98e238d3 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 27 Aug 2008 14:58:32 +0000 Subject: rename Screen part2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1306 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 1398 ++++++++++++++++++++++ src/screens/UScreenEdit.pas | 121 ++ src/screens/UScreenEditConvert.pas | 584 +++++++++ src/screens/UScreenEditHeader.pas | 380 ++++++ src/screens/UScreenEditSub.pas | 1368 ++++++++++++++++++++++ src/screens/UScreenLevel.pas | 103 ++ src/screens/UScreenLoading.pas | 57 + src/screens/UScreenMain.pas | 256 ++++ src/screens/UScreenName.pas | 243 ++++ src/screens/UScreenOpen.pas | 173 +++ src/screens/UScreenOptions.pas | 196 ++++ src/screens/UScreenOptionsAdvanced.pas | 113 ++ src/screens/UScreenOptionsGame.pas | 117 ++ src/screens/UScreenOptionsGraphics.pas | 113 ++ src/screens/UScreenOptionsLyrics.pas | 103 ++ src/screens/UScreenOptionsRecord.pas | 785 +++++++++++++ src/screens/UScreenOptionsSound.pas | 133 +++ src/screens/UScreenOptionsThemes.pas | 171 +++ src/screens/UScreenPartyNewRound.pas | 439 +++++++ src/screens/UScreenPartyOptions.pas | 279 +++++ src/screens/UScreenPartyPlayer.pas | 340 ++++++ src/screens/UScreenPartyScore.pas | 302 +++++ src/screens/UScreenPartyWin.pas | 267 +++++ src/screens/UScreenPopup.pas | 252 ++++ src/screens/UScreenScore.pas | 848 ++++++++++++++ src/screens/UScreenSing.pas | 934 +++++++++++++++ src/screens/UScreenSingModi.pas | 707 +++++++++++ src/screens/UScreenSong.pas | 2019 ++++++++++++++++++++++++++++++++ src/screens/UScreenSongJumpto.pas | 212 ++++ src/screens/UScreenSongMenu.pas | 641 ++++++++++ src/screens/UScreenStatDetail.pas | 270 +++++ src/screens/UScreenStatMain.pas | 301 +++++ src/screens/UScreenTop5.pas | 175 +++ src/screens/UScreenWelcome.pas | 122 ++ 34 files changed, 14522 insertions(+) create mode 100644 src/screens/UScreenCredits.pas create mode 100644 src/screens/UScreenEdit.pas create mode 100644 src/screens/UScreenEditConvert.pas create mode 100644 src/screens/UScreenEditHeader.pas create mode 100644 src/screens/UScreenEditSub.pas create mode 100644 src/screens/UScreenLevel.pas create mode 100644 src/screens/UScreenLoading.pas create mode 100644 src/screens/UScreenMain.pas create mode 100644 src/screens/UScreenName.pas create mode 100644 src/screens/UScreenOpen.pas create mode 100644 src/screens/UScreenOptions.pas create mode 100644 src/screens/UScreenOptionsAdvanced.pas create mode 100644 src/screens/UScreenOptionsGame.pas create mode 100644 src/screens/UScreenOptionsGraphics.pas create mode 100644 src/screens/UScreenOptionsLyrics.pas create mode 100644 src/screens/UScreenOptionsRecord.pas create mode 100644 src/screens/UScreenOptionsSound.pas create mode 100644 src/screens/UScreenOptionsThemes.pas create mode 100644 src/screens/UScreenPartyNewRound.pas create mode 100644 src/screens/UScreenPartyOptions.pas create mode 100644 src/screens/UScreenPartyPlayer.pas create mode 100644 src/screens/UScreenPartyScore.pas create mode 100644 src/screens/UScreenPartyWin.pas create mode 100644 src/screens/UScreenPopup.pas create mode 100644 src/screens/UScreenScore.pas create mode 100644 src/screens/UScreenSing.pas create mode 100644 src/screens/UScreenSingModi.pas create mode 100644 src/screens/UScreenSong.pas create mode 100644 src/screens/UScreenSongJumpto.pas create mode 100644 src/screens/UScreenSongMenu.pas create mode 100644 src/screens/UScreenStatDetail.pas create mode 100644 src/screens/UScreenStatMain.pas create mode 100644 src/screens/UScreenTop5.pas create mode 100644 src/screens/UScreenWelcome.pas (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas new file mode 100644 index 00000000..f7f1fca7 --- /dev/null +++ b/src/screens/UScreenCredits.pas @@ -0,0 +1,1398 @@ +unit UScreenCredits; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + gl, + UMusic, + UFiles, + SysUtils, + UThemes, + //ULCD, + //ULight, + UGraphicClasses; + +type + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + + TScreenCredits = class(TMenu) + public + + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; + + credits_entry_tex: TTexture; + credits_entry_dx_tex: TTexture; + credits_bg_tex: TTexture; + credits_bg_ovl: TTexture; +// credits_bg_logo: TTexture; + credits_bg_scrollbox_left: TTexture; + credits_blindguard: TTexture; + credits_blindy: TTexture; + credits_canni: TTexture; + credits_commandio: TTexture; + credits_lazyjoker: TTexture; + credits_mog: TTexture; + credits_mota: TTexture; + credits_skillmaster: TTexture; + credits_whiteshark: TTexture; + intro_layer01: TTexture; + intro_layer02: TTexture; + intro_layer03: TTexture; + intro_layer04: TTexture; + intro_layer05: TTexture; + intro_layer06: TTexture; + intro_layer07: TTexture; + intro_layer08: TTexture; + intro_layer09: TTexture; + outro_bg: TTexture; + outro_esc: TTexture; + outro_exd: TTexture; + + deluxe_slidein: cardinal; + + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; + + CRDTS_Stage: TCreditsStages; + + myTex: glUint; + mysdlimage,myconvertedsdlimage: PSDL_Surface; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure DrawCredits; + procedure Draw_FunkyText; + end; + +const + Funky_Text: AnsiString = + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ + 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ + 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; + + + Timings: array[0..21] of Cardinal=( + 20, // 0 Delay vor Start + + 149, // 1 Ende erster Intro Zoom + 155, // 2 Start 2. Action im Intro + 170, // 3 Ende Separation im Intro + 271, // 4 Anfang Zoomout im Intro + 0, // 5 unused + 261, // 6 Start fade-to-white im Intro + + 271, // 7 Start Main Part + 280, // 8 Start On-Beat-Sternchen Main Part + + 396, // 9 Start BlindGuard + 666, // 10 Start blindy + 936, // 11 Start Canni + 1206, // 12 Start Commandio + 1476, // 13 Start LazyJoker + 1746, // 14 Start Mog + 2016, // 15 Start Mota + 2286, // 16 Start SkillMaster + 2556, // 17 Start WhiteShark + 2826, // 18 Ende Whiteshark + 3096, // 19 Start FadeOut Mainscreen + 3366, // 20 Ende Credits Tune + 60); // 21 start flare im intro + + + sdl32bpprgba: TSDL_Pixelformat=(palette: nil; + BitsPerPixel: 32; + BytesPerPixel: 4; + Rloss: 0; + Gloss: 0; + Bloss: 0; + Aloss: 0; + Rshift: 0; + Gshift: 8; + Bshift: 16; + Ashift: 24; + Rmask: $000000ff; + Gmask: $0000ff00; + Bmask: $00ff0000; + Amask: $ff000000; + colorkey: 0; + alpha: 255 ); + + +implementation + +uses + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + Math; + + +function TScreenCredits.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenMain); + AudioPlayback.PlaySound(SoundLib.Back); + end; +{ SDLK_SPACE: + begin + setlength(CTime_hold,length(CTime_hold)+1); + CTime_hold[high(CTime_hold)]:=CTime; + end; +} + end;//esac + end; //fi +end; + +constructor TScreenCredits.Create; +begin + inherited Create; + + credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', TEXTURE_TYPE_PLAIN, 0); + credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', TEXTURE_TYPE_TRANSPARENT, 0); + + credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', TEXTURE_TYPE_TRANSPARENT, 0); + credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', TEXTURE_TYPE_TRANSPARENT, 0); + credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', TEXTURE_TYPE_TRANSPARENT, 0); + credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', TEXTURE_TYPE_TRANSPARENT, 0); + credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', TEXTURE_TYPE_TRANSPARENT, 0); + credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', TEXTURE_TYPE_TRANSPARENT, 0); + credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', TEXTURE_TYPE_TRANSPARENT, 0); + credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', TEXTURE_TYPE_TRANSPARENT, 0); + credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', TEXTURE_TYPE_TRANSPARENT, 0); + + intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', TEXTURE_TYPE_TRANSPARENT, 0); + + outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', TEXTURE_TYPE_PLAIN, 0); + outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', TEXTURE_TYPE_TRANSPARENT, 0); + outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', TEXTURE_TYPE_TRANSPARENT, 0); + + CRDTS_Stage:=InitialDelay; +end; + +function TScreenCredits.Draw: boolean; +begin + DrawCredits; + Draw:=true; +end; + +function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; +begin + if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and + (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and + (fmt1.Rloss = fmt2.Rloss) and + (fmt1.Gloss = fmt2.Gloss) and + (fmt1.Bloss = fmt2.Bloss) and + (fmt1.Rmask = fmt2.Rmask) and + (fmt1.Gmask = fmt2.Gmask) and + (fmt1.Bmask = fmt2.Bmask) and + (fmt1.Rshift = fmt2.Rshift) and + (fmt1.Gshift = fmt2.Gshift) and + (fmt1.Bshift = fmt2.Bshift) + then + pixfmt_eq:=True + else + pixfmt_eq:=False; +end; + +function inttohexstr(i: cardinal):pchar; +var helper, i2, c:cardinal; + tmpstr: string; +begin + helper:=0; + i2:=i; + tmpstr:=''; + for c:=1 to 8 do + begin + helper:=(helper shl 4) or (i2 and $f); + i2:=i2 shr 4; + end; + for c:=1 to 8 do + begin + i2:=helper and $f; + helper := helper shr 4; + case i2 of + 0: tmpstr:=tmpstr+'0'; + 1: tmpstr:=tmpstr+'1'; + 2: tmpstr:=tmpstr+'2'; + 3: tmpstr:=tmpstr+'3'; + 4: tmpstr:=tmpstr+'4'; + 5: tmpstr:=tmpstr+'5'; + 6: tmpstr:=tmpstr+'6'; + 7: tmpstr:=tmpstr+'7'; + 8: tmpstr:=tmpstr+'8'; + 9: tmpstr:=tmpstr+'9'; + 10: tmpstr:=tmpstr+'a'; + 11: tmpstr:=tmpstr+'b'; + 12: tmpstr:=tmpstr+'c'; + 13: tmpstr:=tmpstr+'d'; + 14: tmpstr:=tmpstr+'e'; + 15: tmpstr:=tmpstr+'f'; + end; + end; + inttohexstr:=pchar(tmpstr); +end; + +procedure TScreenCredits.onShow; +begin + inherited; + + CRDTS_Stage:=InitialDelay; + Credits_X := 580; + deluxe_slidein := 0; + Credits_Alpha := 0; + //Music.SetLoop(true); Loop looped ned, so ne scheisse - loop loops not, shit + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! - thank you wetü +// Music.Play; + CTime:=0; +// setlength(CTime_hold,0); + + mysdlimage:=IMG_Load('test.png'); + if assigned(mysdlimage) then + begin + showmessage('opened image via SDL_Image'+#13#10+ + 'Width: '+inttostr(mysdlimage^.w)+#13#10+ + 'Height: '+inttostr(mysdlimage^.h)+#13#10+ + 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ + 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ + 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ + 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ + 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ + 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ + 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ + 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ + 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ + 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ + 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ + 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ + 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ + 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ + 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ + 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); + + if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then + showmessage('equal pixelformats') + else + showmessage('different pixelformats'); + + myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); + glGenTextures(1,@myTex); + glBindTexture(GL_TEXTURE_2D, myTex); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); + glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); + glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, + GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); + SDL_FreeSurface(mysdlimage); + SDL_FreeSurface(myconvertedsdlimage); + end + else + showmessage('could not open file - test.png'); + +end; + +procedure TScreenCredits.onHide; +begin + AudioPlayback.Stop; +end; + +Procedure TScreenCredits.Draw_FunkyText; +var + S: Integer; + X,Y,A: Real; + visibleText: PChar; +begin + SetFontSize(10); + //Init ScrollingText + if (CTime = Timings[7]) then + begin + //Set Position of Text + Credits_X := 600; + CurrentScrollStart:=1; + CurrentScrollEnd:=1; + end; + + if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + begin + X:=0; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + for S := 0 to length(visibleText)-1 do begin + Y:=abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X,538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + A:=0; + if (Credits_X+X < 15) then A:=0; + if (Credits_X+X >=15) then A:=Credits_X+X-15; + if Credits_X+X > 32 then A:=17; + glColor4f( 230/255-40/255+Y*(Credits_X+X)/900, 200/255-30/255+Y*(Credits_X+X)/1000, 155/255-20/255+Y*(Credits_X+X)/1100, A/17); + glPrintLetter(visibleText[S]); + X := X + Fonts[ActFont].Width[Ord(visibleText[S])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + end; + if (Credits_X<0) and (CurrentScrollStart < length(Funky_Text)) then begin + Credits_X:=Credits_X + Fonts[ActFont].Width[Ord(Funky_Text[CurrentScrollStart])] * Fonts[ActFont].Tex.H / 30 * Fonts[ActFont].AspectW; + inc(CurrentScrollStart); + end; + visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); + if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + inc(CurrentScrollEnd); + end; + end; +{ // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=pchar(inttostr(CTime_hold[S])); + SetFontPos (500, X); + glPrint (Addr(visibleText[0])); + X:=X+20; + end;} +end; + +procedure Start3D; +begin + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; +end; +procedure End3D; +begin + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); +end; + +procedure TScreenCredits.DrawCredits; +var +T{*, I*}: Cardinal; // Auto Removed, Unused Variable (I) // Auto Removed, Unused Variable (I) +// X: Real; // Auto Removed, Unused Variable +// Ver: PChar; // Auto Removed, Unused Variable +// RuntimeStr: AnsiString; // Auto Removed, Unused Variable + Data: TFFTData; + j,k,l:cardinal; +f,g{*, h*}: Real; // Auto Removed, Unused Variable (h) // Auto Removed, Unused Variable (h) + STime:cardinal; + Delay:cardinal; + +// myPixel: longword; // Auto Removed, Unused Variable +// myColor: Cardinal; // Auto Removed, Unused Variable + myScale: Real; + myAngle: Real; + + +const myLogoCoords: Array[0..27,0..1] of Cardinal = ((39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93)); + +begin + //dis does teh muiwk y0r + AudioPlayback.GetFFTData(Data); + + Log.LogStatus('',' JB-1'); + + T := SDL_GetTicks() div 33; + if T <> Credits_Time then + begin + Credits_Time := T; + inc(CTime); + inc(CTime_hold); + Credits_X := Credits_X-2; + + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + begin +// CTime:=Timings[20]; +// CRDTS_Stage:=Outro; + + CRDTS_Stage:=Intro; + CTime:=0; + AudioPlayback.Play; + + end; + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + begin + CRDTS_Stage:=MainPart; + end; + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + begin + CRDTS_Stage:=Outro; + end; + end; + + Log.LogStatus('',' JB-3'); + + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end + else + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; + + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; +// if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow +// myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); +// glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); + + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; + + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; + if (CRDTS_Stage=MainPart) then + // main credits screen background, scroller, logo and girl + begin + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // draw scroller + Draw_FunkyText; + +//######################################################################### +// draw credits names + + +Log.LogStatus('',' JB-4'); + +// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - (rotate in from upper left, rotate out to lower right) + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Canni (von links reinschieben, nach rechts oben rausschieben) - (shift in from left, shift out to upper right) + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); + end; + glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Commandio (von unten reinklappen, nach rechts oben rausklappen) - (flip in from down, flip out to upper right) + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) + else + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; + if CTime > STime then + begin + k:=0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); + + glPushMatrix; + gltranslatef(180+(f-70),329,0); + glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mog (von links reinklappen, nach rechts unten rausklappen) - (flip in from right, flip out to lower right) + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; + glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - (rotate in from upper right, shift out to lower left while shrinking and rotateing) + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - (shift in from lower right, rotate out to upper right) + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); + end; + glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + +// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - (flip in from lower left, flip out to upper right) + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; + if CTime > STime then + begin + k:=0; + ESC_Alpha:=20; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); + end; + + glPushMatrix; + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) + else + f:=0; + + if (CTime >= STime+Delay-10) and (CTime <= STime+Delay) then + begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end + else + begin + g:=0; + end; + + glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); + glEnd; + gldisable(gl_texture_2d); + gldisable(GL_BLEND); + glPopMatrix; + end; + + + Log.LogStatus('',' JB-103'); + +// #################################################################### +// do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then + begin + k := 0; + + try + for j:=0 to 40 do + begin + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then + begin + if Data[j] >= Data[k] then + k:=j; + end; + end; + except + end; + + if Data[k]>0.2 then + begin + l := RandomRange(6,16); + j := RandomRange(0,27); + + GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); + end; + end; + +//################################################# +// draw the rest of the main screen (girl and logo + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); + glEnd; +{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); + glEnd; +} + gldisable(gl_texture_2d); + glDisable(GL_BLEND); + + // fade out at end of main part + if Ctime > Timings[19] then + begin + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + end + else + if (CRDTS_Stage=Outro) then + begin + if CTime=Timings[20] then begin + CTime_hold:=0; + AudioPlayback.Stop; + AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.SetVolume(0.2); + AudioPlayback.SetLoop(True); + AudioPlayback.Play; + end; + if CTime_hold > 231 then begin + AudioPlayback.Play; + Ctime_hold:=0; + end; + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); + glEnd; + + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); + glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); + glEnd; + + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); + glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + // outro scrollers? + // ... + end; + +{ // draw credits runtime counter + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(9); + SetFontPos (5, 5); + glColor4f(1, 1, 1, 1); +// RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); + glPrint (Addr(RuntimeStr[1])); +} + + + glEnable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + glColor4f(1, 1, 1, 1); + glBindTexture(GL_TEXTURE_2D, myTex); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex2f(100, 100); + glTexCoord2f(0,1);glVertex2f(100, 200); + glTexCoord2f(1,1); glVertex2f(200, 200); + glTexCoord2f(1,0);glVertex2f(200, 100); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + + // make the stars shine + GoldenRec.Draw; +end; + +end. diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas new file mode 100644 index 00000000..bf664eb1 --- /dev/null +++ b/src/screens/UScreenEdit.pas @@ -0,0 +1,121 @@ +unit UScreenEdit; + +interface + +{$I switches.inc} + +uses UMenu, SDL, UThemes; + +type + TScreenEdit = class(TMenu) + public +{ Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + FileName: string;} + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, USkins, SysUtils; + +function TScreenEdit.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); +// Result := false; + end; + SDLK_RETURN: + begin + if Interaction = 0 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenEditConvert); + end; +// if Interaction = 1 then begin +// Music.PlayStart; +// FadeTo(@ScreenEditHeader); +// end; + + if Interaction = 1 then + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end; + end; + + SDLK_DOWN: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + end; + end; +end; + +constructor TScreenEdit.Create; +begin + inherited Create; + AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); +// Button[High(Button)].Text[0].Size := 11; + +// AddButton(400-200, 100 + 1*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Edit Headers'); + +// AddButton(400-200, 100 + 2*60, 400, 40, 'ButtonF'); +// AddButtonText(10, 5, 0, 0, 0, 'Set GAP'); + + AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Exit'); + +end; + +procedure TScreenEdit.onShow; +begin + inherited; + +// Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +end; + +procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas new file mode 100644 index 00000000..dfde696e --- /dev/null +++ b/src/screens/UScreenEditConvert.pas @@ -0,0 +1,584 @@ +unit UScreenEditConvert; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + USong, + UMusic, + UThemes; + +type + TNote = record + Event: integer; + EventType: integer; + Channel: integer; + Start: real; + Len: real; + Data1: integer; + Data2: integer; + Str: string; + end; + + TTrack = record + Note: array of TNote; + Name: string; + Hear: boolean; + Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics + end; + + TNuta = record + Start: integer; + Len: integer; + Tone: integer; + Lyric: string; + NewSentence: boolean; + end; + + TArrayTrack = array of TTrack; + + TScreenEditConvert = class(TMenu) + public + ATrack: TArrayTrack; // actual track +// Track: TArrayTrack; + Channel: TArrayTrack; + ColR: array[0..100] of real; + ColG: array[0..100] of real; + ColB: array[0..100] of real; + Len: real; + Sel: integer; + Selected: boolean; +// FileName: string; + + {$IFDEF UseMIDIPort} + MidiFile: TMidiFile; + MidiTrack: TMidiTrack; + MidiEvent: pMidiEvent; + MidiOut: TMidiOutput; + {$ENDIF} + + Song: TSong; + Lines: TLines; + BPM: real; + Ticks: real; + Note: array of TNuta; + + procedure AddLyric(Start: integer; Text: string); + procedure Extract; + + {$IFDEF UseMIDIPort} + procedure MidiFile1MidiEvent(event: PMidiEvent); + {$ENDIF} + + function SelectedNumber: integer; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation +uses UGraphic, + SysUtils, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + gl, + USkins; + +function TScreenEditConvert.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + {$IFDEF UseMIDIPort} + MidiFile.StopPlaying; + {$ENDIF} + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenEdit); + end; + + SDLK_RETURN: + begin + if Interaction = 0 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + ScreenOpen.BackScreen := @ScreenEditConvert; + FadeTo(@ScreenOpen); + end; + + if Interaction = 1 then + begin + Selected := false; + {$IFDEF UseMIDIPort} + MidiFile.OnMidiEvent := MidiFile1MidiEvent; +// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); + MidiFile.StartPlaying; + {$ENDIF} + end; + + if Interaction = 2 then begin + Selected := true; + {$IFDEF UseMIDIPort} + MidiFile.OnMidiEvent := nil; + {$ENDIF} + {for T := 0 to High(ATrack) do begin + if ATrack[T].Hear then begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + end; + end; + MidiFile.StartPlaying;//} + end; + + if Interaction = 3 then begin + if SelectedNumber > 0 then begin + Extract; + SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false); + end; + end; + + end; + + SDLK_SPACE: + begin +// ATrack[Sel].Hear := not ATrack[Sel].Hear; + ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; + +{ if Selected then begin + MidiTrack := MidiFile.GetTrack(Sel); + if Track[Sel].Hear then + MidiTrack.OnMidiEvent := MidiFile1MidiEvent + else + MidiTrack.OnMidiEvent := nil; + end;} + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_DOWN: + begin + Inc(Sel); + if Sel > High(ATrack) then Sel := 0; + end; + SDLK_UP: + begin + Dec(Sel); + if Sel < 0 then Sel := High(ATrack); + end; + end; + end; +end; + +procedure TScreenEditConvert.AddLyric(Start: integer; Text: string); +var + N: integer; +begin + for N := 0 to High(Note) do begin + if Note[N].Start = Start then begin + // check for new sentece + if Copy(Text, 1, 1) = '\' then Delete(Text, 1, 1); + if Copy(Text, 1, 1) = '/' then begin + Delete(Text, 1, 1); + Note[N].NewSentence := true; + end; + + // overwrite lyric od append + if Note[N].Lyric = '-' then + Note[N].Lyric := Text + else + Note[N].Lyric := Note[N].Lyric + Text; + end; + end; +end; + +procedure TScreenEditConvert.Extract; +var + T: integer; + C: integer; + N: integer; + Nu: integer; + NoteTemp: TNuta; + Move: integer; + Max, Min: integer; +begin + // song info + Song.Title := ''; + Song.Artist := ''; + Song.Mp3 := ''; + Song.Resolution := 4; + SetLength(Song.BPM, 1); + Song.BPM[0].BPM := BPM*4; + + SetLength(Note, 0); + + // extract notes + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 1) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin + Nu := Length(Note); + SetLength(Note, Nu + 1); + Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); + Note[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks); + Note[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5; + Note[Nu].Lyric := '-'; + end; + end; + end; + end; + + // extract lyrics + for T := 0 to High(ATrack) do begin +// if ATrack[T].Hear then begin + if ((ATrack[T].Status div 2) and 1) = 1 then begin + for N := 0 to High(ATrack[T].Note) do begin + if (ATrack[T].Note[N].EventType = 15) then begin +// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); + AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); + end; + end; + end; + end; + + // sort notes + for N := 0 to High(Note) do + for Nu := 0 to High(Note)-1 do + if Note[Nu].Start > Note[Nu+1].Start then begin + NoteTemp := Note[Nu]; + Note[Nu] := Note[Nu+1]; + Note[Nu+1] := NoteTemp; + end; + + // move to 0 at beginning + Move := Note[0].Start; + for N := 0 to High(Note) do + Note[N].Start := Note[N].Start - Move; + + // copy notes + SetLength(Lines.Line, 1); + Lines.Number := 1; + Lines.High := 0; + + C := 0; + N := 0; + Lines.Line[C].HighNote := -1; + + for Nu := 0 to High(Note) do begin + if Note[Nu].NewSentence then begin // nowa linijka + SetLength(Lines.Line, Length(Lines.Line)+1); + Lines.Number := Lines.Number + 1; + Lines.High := Lines.High + 1; + C := C + 1; + N := 0; + SetLength(Lines.Line[C].Note, 0); + Lines.Line[C].HighNote := -1; + + //Calculate Start of the Last Sentence + if (C > 0) and (Nu > 0) then + begin + Max := Note[Nu].Start; + Min := Note[Nu-1].Start + Note[Nu-1].Len; + + case (Max - Min) of + 0: Lines.Line[C].Start := Max; + 1: Lines.Line[C].Start := Max; + 2: Lines.Line[C].Start := Max - 1; + 3: Lines.Line[C].Start := Max - 2; + else + if ((Max - Min) > 4) then + Lines.Line[C].Start := Min + 2 + else + Lines.Line[C].Start := Max; + + end; // case + + end; + end; + + // tworzy miejsce na nowa nute + SetLength(Lines.Line[C].Note, Length(Lines.Line[C].Note)+1); + + // dopisuje + Lines.Line[C].Note[N].Start := Note[Nu].Start; + Lines.Line[C].Note[N].Length := Note[Nu].Len; + Lines.Line[C].Note[N].Tone := Note[Nu].Tone; + Lines.Line[C].Note[N].Text := Note[Nu].Lyric; + //All Notes are Freestyle when Converted Fix: + Lines.Line[C].Note[N].NoteType := ntNormal; + Inc(N); + end; +end; + +function TScreenEditConvert.SelectedNumber: integer; +var + T: integer; // track +begin + Result := 0; + for T := 0 to High(ATrack) do +// if ATrack[T].Hear then Inc(Result); + if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); +end; + +{$IFDEF UseMIDIPort} +procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); +begin +// Log.LogStatus(IntToStr(event.event), 'MIDI'); + MidiOut.PutShort(event.event, event.data1, event.data2); +end; +{$ENDIF} + +constructor TScreenEditConvert.Create; +var + P: integer; +begin + inherited Create; + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 0, 0, 0, 'Open'); +// Button[High(Button)].Text[0].Size := 11; + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play'); + + AddButton(280, 20, 200, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(25, 5, 0, 0, 0, 'Play Selected'); + + AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 0, 0, 0, 'Save'); + + +{ MidiOut := TMidiOutput.Create(nil); +// MidiOut.Close; +// MidiOut.DeviceID := 0; + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; +// MidiOut.SetVolume(100, 100); // temporary} + + ConversionFileName := GamePath + 'file.mid'; + {$IFDEF UseMIDIPort} + MidiFile := TMidiFile.Create(nil); + {$ENDIF} + + for P := 0 to 100 do begin + ColR[P] := Random(10)/10; + ColG[P] := Random(10)/10; + ColB[P] := Random(10)/10; + end; + +end; + +procedure TScreenEditConvert.onShow; +var + T: integer; // track + N: integer; // note + C: integer; // channel + CN: integer; // channel note +begin + inherited; + +{$IFDEF UseMIDIPort} + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + Log.LogStatus(MidiOut.ProductName, 'MIDI'); + MidiOut.Open; + + + if FileExists(ConversionFileName) then + begin + MidiFile.Filename := ConversionFileName; + MidiFile.ReadFile; + + + Len := 0; + Sel := 0; + BPM := MidiFile.Bpm; + Ticks := MidiFile.TicksPerQuarter / 4; + +{ for T := 0 to MidiFile.NumberOfTracks-1 do begin + SetLength(Track, Length(Track)+1); + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + Track[T].Name := MidiTrack.getName; + + for N := 0 to MidiTrack.getEventCount-1 do begin + SetLength(Track[T].Note, Length(Track[T].Note)+1); + MidiEvent := MidiTrack.GetEvent(N); + Track[T].Note[N].Start := MidiEvent.time; + Track[T].Note[N].Len := MidiEvent.len; + Track[T].Note[N].Event := MidiEvent.event; + Track[T].Note[N].EventType := MidiEvent.event div 16; + Track[T].Note[N].Channel := MidiEvent.event and 15; + Track[T].Note[N].Data1 := MidiEvent.data1; + Track[T].Note[N].Data2 := MidiEvent.data2; + Track[T].Note[N].Str := MidiEvent.str; + + if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then + Len := Track[T].Note[N].Start + Track[T].Note[N].Len; + end; + end;} + + + SetLength(Channel, 16); + for T := 0 to 15 do + begin + Channel[T].Name := IntToStr(T+1); + SetLength(Channel[T].Note, 0); + Channel[T].Status := 0; + end; + + for T := 0 to MidiFile.NumberOfTracks-1 do begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := MidiFile1MidiEvent; + + for N := 0 to MidiTrack.getEventCount-1 do begin + MidiEvent := MidiTrack.GetEvent(N); + C := MidiEvent.event and 15; + + CN := Length(Channel[C].Note); + SetLength(Channel[C].Note, CN+1); + + Channel[C].Note[CN].Start := MidiEvent.time; + Channel[C].Note[CN].Len := MidiEvent.len; + Channel[C].Note[CN].Event := MidiEvent.event; + Channel[C].Note[CN].EventType := MidiEvent.event div 16; + Channel[C].Note[CN].Channel := MidiEvent.event and 15; + Channel[C].Note[CN].Data1 := MidiEvent.data1; + Channel[C].Note[CN].Data2 := MidiEvent.data2; + Channel[C].Note[CN].Str := MidiEvent.str; + + if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then + Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len; + end; + end; + ATrack := Channel; + + end; + + Interaction := 0; +{$ENDIF} +end; + +function TScreenEditConvert.Draw: boolean; +var + Pet: integer; + Pet2: integer; + Bottom: real; + X: real; + Y: real; + H: real; + YSkip: real; +begin + // draw static menu + inherited Draw; + + Y := 100; + + H := Length(ATrack)*40; + if H > 480 then H := 480; + Bottom := Y + H; + + YSkip := H / Length(ATrack); + + // select + DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + + // selected - now me use Status System + for Pet := 0 to High(ATrack) do + if ATrack[Pet].Hear then + DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + glColor3f(0, 0, 0); + for Pet := 0 to High(ATrack) do begin + if ((ATrack[Pet].Status div 1) and 1) = 1 then begin + SetFontPos(25, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('N'); + end; + if ((ATrack[Pet].Status div 2) and 1) = 1 then begin + SetFontPos(40, Y + Pet*YSkip + 10); + SetFontSize(5); + glPrint('L'); + end; + end; + + DrawLine(10, Y, 10, Bottom, 0, 0, 0); + DrawLine(60, Y, 60, Bottom, 0, 0, 0); + DrawLine(790, Y, 790, Bottom, 0, 0, 0); + + for Pet := 0 to Length(ATrack) do + DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0); + + for Pet := 0 to High(ATrack) do begin + SetFontPos(11, Y + 10 + Pet*YSkip); + SetFontSize(5); + glPrint(pchar(ATrack[Pet].Name)); + end; + + for Pet := 0 to High(ATrack) do + for Pet2 := 0 to High(ATrack[Pet].Note) do begin + if ATrack[Pet].Note[Pet2].EventType = 9 then + DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]); + if ATrack[Pet].Note[Pet2].EventType = 15 then + DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]); + end; + + // playing line + {$IFDEF UseMIDIPort} + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + {$ENDIF} + DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); + + Result := true; +end; + +procedure TScreenEditConvert.onHide; +begin +{$IFDEF UseMIDIPort} + MidiOut.Close; + MidiOut.Free; +{$ENDIF} +end; + +end. diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas new file mode 100644 index 00000000..28bf7682 --- /dev/null +++ b/src/screens/UScreenEditHeader.pas @@ -0,0 +1,380 @@ +unit UScreenEditHeader; + +interface + +{$I switches.inc} + +uses UMenu, + SDL, + USongs, + USong, + UThemes; + +type + TScreenEditHeader = class(TMenu) + public + CurrentSong: TSong; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBackground: integer; + TextVideo: integer; + TextVideoGAP: integer; + TextRelative: integer; + TextResolution: integer; + TextNotesGAP: integer; + TextStart: integer; + TextGAP: integer; + TextBPM: integer; + StaticTitle: integer; + StaticArtist: integer; + StaticMp3: integer; + StaticBackground: integer; + StaticVideo: integer; + StaticVideoGAP: integer; + StaticRelative: integer; + StaticResolution: integer; + StaticNotesGAP: integer; + StaticStart: integer; + StaticGAP: integer; + StaticBPM: integer; + Sel: array[0..11] of boolean; + procedure SetRoundButtons; + + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; +{ function Draw: boolean; override; + procedure Finish;} + end; + +implementation + +uses UGraphic, UMusic, SysUtils, UFiles, USkins, UTexture; + +function TScreenEditHeader.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + T: integer; +begin + Result := true; + If (PressedDown) Then begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE : + begin +// Music.PlayBack; +// FadeTo(@MainScreen); + Result := false; + end; + + SDLK_RETURN: + begin + if Interaction = 1 then begin +// Save; + end; + end; + + SDLK_RIGHT: + begin + case Interaction of + 0..0: InteractNext; + 1: Interaction := 0; + end; + end; + + SDLK_LEFT: + begin + case Interaction of + 0: Interaction := 1; + 1..1: InteractPrev; + end; + end; + + SDLK_DOWN: + begin + case Interaction of + 0..1: Interaction := 2; + 2..12: InteractNext; + 13: Interaction := 0; + end; + end; + + SDLK_UP: + begin + case Interaction of + 0..1: Interaction := 13; + 2: Interaction := 0; + 3..13: InteractPrev; + end; + end; + + SDLK_BACKSPACE: + begin + T := Interaction - 2 + TextTitle; + if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin + Text[T].DeleteLastL; + SetRoundButtons; + end; + end; + + end; + case CharCode of + #32..#255: + begin + if (Interaction >= 2) and (Interaction <= 13) then begin + Text[Interaction - 2 + TextTitle].Text := + Text[Interaction - 2 + TextTitle].Text + CharCode; + SetRoundButtons; + end; + end; + end; + end; +end; + +constructor TScreenEditHeader.Create; +begin + inherited Create; + + AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(15, 5, 'Open'); + + AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(20, 5, 'Save'); + + AddBox(80, 60, 640, 550); + + AddText(160, 110 + 0*30, 0, 10, 0, 0, 0, 'Title:'); + AddText(160, 110 + 1*30, 0, 10, 0, 0, 0, 'Artist:'); + AddText(160, 110 + 2*30, 0, 10, 0, 0, 0, 'MP3:'); + + AddText(160, 110 + 4*30, 0, 10, 0, 0, 0, 'Background:'); + AddText(160, 110 + 5*30, 0, 10, 0, 0, 0, 'Video:'); + AddText(160, 110 + 6*30, 0, 10, 0, 0, 0, 'VideoGAP:'); + + AddText(160, 110 + 8*30, 0, 10, 0, 0, 0, 'Relative:'); + AddText(160, 110 + 9*30, 0, 10, 0, 0, 0, 'Resolution:'); + AddText(160, 110 + 10*30, 0, 10, 0, 0, 0, 'NotesGAP:'); + + AddText(160, 110 + 12*30, 0, 10, 0, 0, 0, 'Start:'); + AddText(160, 110 + 13*30, 0, 10, 0, 0, 0, 'GAP:'); + AddText(160, 110 + 14*30, 0, 10, 0, 0, 0, 'BPM:'); + + TextTitle := AddText(340, 110 + 0*30, 0, 10, 0, 0, 0, ''); + TextArtist := AddText(340, 110 + 1*30, 0, 10, 0, 0, 0, ''); + TextMp3 := AddText(340, 110 + 2*30, 0, 10, 0, 0, 0, ''); + + TextBackground := AddText(340, 110 + 4*30, 0, 10, 0, 0, 0, ''); + TextVideo := AddText(340, 110 + 5*30, 0, 10, 0, 0, 0, ''); + TextVideoGAP := AddText(340, 110 + 6*30, 0, 10, 0, 0, 0, ''); + + TextRelative := AddText(340, 110 + 8*30, 0, 10, 0, 0, 0, ''); + TextResolution := AddText(340, 110 + 9*30, 0, 10, 0, 0, 0, ''); + TextNotesGAP := AddText(340, 110 + 10*30, 0, 10, 0, 0, 0, ''); + + TextStart := AddText(340, 110 + 12*30, 0, 10, 0, 0, 0, ''); + TextGAP := AddText(340, 110 + 13*30, 0, 10, 0, 0, 0, ''); + TextBPM := AddText(340, 110 + 14*30, 0, 10, 0, 0, 0, ''); + + StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + + AddInteraction(iText, TextTitle); + AddInteraction(iText, TextArtist); + AddInteraction(iText, TextMp3); + AddInteraction(iText, TextBackground); + AddInteraction(iText, TextVideo); + AddInteraction(iText, TextVideoGAP); + AddInteraction(iText, TextRelative); + AddInteraction(iText, TextResolution); + AddInteraction(iText, TextNotesGAP); + AddInteraction(iText, TextStart); + AddInteraction(iText, TextGAP); + AddInteraction(iText, TextBPM); +end; + +procedure TScreenEditHeader.onShow; +begin + inherited; + +{ if FileExists(FileName) then begin // load file + CurrentSong.FileName := FileName; + SkanujPlik(CurrentSong); + + SetLength(TrueBoolStrs, 1); + TrueBoolStrs[0] := 'yes'; + SetLength(FalseBoolStrs, 1); + FalseBoolStrs[0] := 'no'; + + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextMP3].Text := CurrentSong.Mp3; + Text[TextBackground].Text := CurrentSong.Background; + Text[TextVideo].Text := CurrentSong.Video; + Text[TextVideoGAP].Text := FloatToStr(CurrentSong.VideoGAP); + Text[TextRelative].Text := BoolToStr(CurrentSong.Relative, true); + Text[TextResolution].Text := IntToStr(CurrentSong.Resolution); + Text[TextNotesGAP].Text := IntToStr(CurrentSong.NotesGAP); + Text[TextStart].Text := FloatToStr(CurrentSong.Start); + Text[TextGAP].Text := FloatToStr(CurrentSong.GAP); + Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM); + SetRoundButtons; + end;} + + Interaction := 0; +end; + +(*function TScreenEdit.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin +{ glClearColor(1,1,1,1); + + // control music + if PlaySentence then begin + // stop the music + if (Music.Position > PlayStopTime) then begin + Music.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin + AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + Text[TextDebug].Text := IntToStr(AktBeat); + if AktBeat <> LastClick then begin + for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + Music.PlayClick; + LastClick := AktBeat; + end; + end; + end; // click + end; // if PlaySentence + + Text[TextSentence].Text := IntToStr(Czesci[0].Akt + 1) + ' / ' + IntToStr(Czesci[0].Ilosc); + Text[TextNote].Text := IntToStr(AktNuta + 1) + ' / ' + IntToStr(Czesci[0].Czesc[Czesci[0].Akt].LengthNote); + + // Song info + Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(CurrentSong.GAP); + + // Note info + Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); + Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); + Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton); + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + SingDrawBeatDelimeters(40, 300, 760, 0); + SingDrawCzesc(40, 405, 760, 0); + + // draw text + Lyric.Draw;} + +end;*) + +procedure TScreenEditHeader.SetRoundButtons; +begin + if Length(Text[TextTitle].Text) > 0 then Static[StaticTitle].Visible := true + else Static[StaticTitle].Visible := false; + + if Length(Text[TextArtist].Text) > 0 then Static[StaticArtist].Visible := true + else Static[StaticArtist].Visible := false; + + if Length(Text[TextMp3].Text) > 0 then Static[StaticMp3].Visible := true + else Static[StaticMp3].Visible := false; + + if Length(Text[TextBackground].Text) > 0 then Static[StaticBackground].Visible := true + else Static[StaticBackground].Visible := false; + + if Length(Text[TextVideo].Text) > 0 then Static[StaticVideo].Visible := true + else Static[StaticVideo].Visible := false; + + try + StrToFloat(Text[TextVideoGAP].Text); + if StrToFloat(Text[TextVideoGAP].Text)<> 0 then Static[StaticVideoGAP].Visible := true + else Static[StaticVideoGAP].Visible := false; + except + Static[StaticVideoGAP].Visible := false; + end; + + if LowerCase(Text[TextRelative].Text) = 'yes' then Static[StaticRelative].Visible := true + else Static[StaticRelative].Visible := false; + + try + StrToInt(Text[TextResolution].Text); + if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) + then Static[StaticResolution].Visible := true + else Static[StaticResolution].Visible := false; + except + Static[StaticResolution].Visible := false; + end; + + try + StrToInt(Text[TextNotesGAP].Text); + Static[StaticNotesGAP].Visible := true; + except + Static[StaticNotesGAP].Visible := false; + end; + + // start + try + StrToFloat(Text[TextStart].Text); + if (StrToFloat(Text[TextStart].Text) > 0) then Static[StaticStart].Visible := true + else Static[StaticStart].Visible := false; + except + Static[StaticStart].Visible := false; + end; + + // GAP + try + StrToFloat(Text[TextGAP].Text); + Static[StaticGAP].Visible := true; + except + Static[StaticGAP].Visible := false; + end; + + // BPM + try + StrToFloat(Text[TextBPM].Text); + if (StrToFloat(Text[TextBPM].Text) > 0) then Static[StaticBPM].Visible := true + else Static[StaticBPM].Visible := false; + except + Static[StaticBPM].Visible := false; + end; + +end; + +(*procedure TScreenEdit.Finish; +begin +// +end;*) + +end. diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas new file mode 100644 index 00000000..2d98f6bc --- /dev/null +++ b/src/screens/UScreenEditSub.pas @@ -0,0 +1,1368 @@ +unit UScreenEditSub; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} +{$I switches.inc} + +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + USong, + UIni, + ULog, + UTexture, + UMenuText, + UEditorLyrics, + Math, + gl, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; + +type + TScreenEditSub = class(TMenu) + private + //Variable is True if no Song is loaded + Error: Boolean; + + TextNote: integer; + TextSentence: integer; + TextTitle: integer; + TextArtist: integer; + TextMp3: integer; + TextBPM: integer; + TextGAP: integer; + TextDebug: integer; + TextNStart: integer; + TextNLength: integer; + TextNTon: integer; + TextNText: integer; + CurrentNote: integer; + PlaySentence: boolean; + PlaySentenceMidi: boolean; + PlayStopTime: real; + LastClick: integer; + Click: boolean; + CopySrc: integer; + + {$IFDEF UseMIDIPort} + MidiOut: TMidiOutput; + {$endif} + + MidiStart: real; + MidiStop: real; + MidiTime: real; + MidiPos: real; + MidiLastNote: integer; + + TextEditMode: boolean; + + Lyric: TEditorLyrics; + + procedure NewBeat; + procedure DivideBPM; + procedure MultiplyBPM; + procedure LyricsCapitalize; + procedure LyricsCorrectSpaces; + procedure FixTimings; + procedure DivideSentence; + procedure JoinSentence; + procedure DivideNote; + procedure DeleteNote; + procedure TransposeNote(Transpose: integer); + procedure ChangeWholeTone(Tone: integer); + procedure MoveAllToEnd(Move: integer); + procedure MoveTextToRight; + procedure MarkSrc; + procedure PasteText; + procedure CopySentence(Src, Dst: integer); + procedure CopySentences(Src, Dst, Num: integer); + //Note Name Mod + function GetNoteName(Note: Integer): String; + public + Tex_Background: TTexture; + FadeOut: boolean; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInputEditText(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; + function Draw: boolean; override; + procedure onHide; override; + end; + +implementation + +uses + UGraphic, + UDraw, + UMain, + USkins, + ULanguage; + +// Method for input parsing. If False is returned, GetNextWindow +// should be checked to know the next window to load; +function TScreenEditSub.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; + R: real; +begin + Result := true; + + if TextEditMode then begin + Result := ParseInputEditText(PressedKey, CharCode, PressedDown); + end else begin + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) then begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + 'S': + begin + // Save Song + if SDL_ModState = KMOD_LSHIFT then + SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, true) + else + SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, false); + + {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then + // Save Song + SaveSongDebug(CurrentSong, Lines[0], 'C:\song.asm', false);} + + Exit; + end; + 'D': + begin + // Divide lengths by 2 + DivideBPM; + Exit; + end; + 'M': + begin + // Multiply lengths by 2 + MultiplyBPM; + Exit; + end; + 'C': + begin + // Capitalize letter at the beginning of line + if SDL_ModState = 0 then + LyricsCapitalize; + + // Correct spaces + if SDL_ModState = KMOD_LSHIFT then + LyricsCorrectSpaces; + + // Copy sentence + if SDL_ModState = KMOD_LCTRL then + MarkSrc; + + Exit; + end; + 'V': + begin + // Paste text + if SDL_ModState = KMOD_LCTRL then begin + if Lines[0].Line[Lines[0].Current].HighNote >= Lines[0].Line[CopySrc].HighNote then + PasteText + else + Log.LogStatus('PasteText: invalid range', 'TScreenEditSub.ParseInput'); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Lines[0].Current); + end; + end; + 'T': + begin + // Fixes timings between sentences + FixTimings; + Exit; + end; + 'P': + begin + if SDL_ModState = 0 then + begin + // Play Sentence + Click := true; + AudioPlayback.Stop; + R := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[0].Start); + if R <= AudioPlayback.Length then + begin + AudioPlayback.Position := R; + PlayStopTime := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].End_); + PlaySentence := true; + AudioPlayback.Play; + LastClick := -100; + end; + end + else if SDL_ModState = KMOD_LSHIFT then + begin + PlaySentenceMidi := true; + + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[0].Start); + MidiStop := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].End_); + + LastClick := -100; + end + else if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL then + begin + PlaySentenceMidi := true; + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[0].Start); + MidiStop := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].End_); + LastClick := -100; + + PlaySentence := true; + Click := true; + AudioPlayback.Stop; + AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[0].Start)+0{-0.10}; + PlayStopTime := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].End_)+0; + AudioPlayback.Play; + LastClick := -100; + end; + Exit; + end; + + // Golden Note Patch + 'G': + begin + if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntGolden) then + Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal + else + Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntGolden; + + Exit; + end; + + // Freestyle Note Patch + 'F': + begin + if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntFreestyle) then + Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal + else + Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntFreestyle; + + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + FadeTo(@ScreenSong); + end; + + SDLK_BACKQUOTE: + begin + // Increase Note Length (same as Alt + Right) + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then + Inc(Lines[0].Line[Lines[0].Current].End_); + end; + + SDLK_EQUALS: + begin + // Increase BPM + if SDL_ModState = 0 then + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 5) + 1) / 5; // (1/20) + if SDL_ModState = KMOD_LSHIFT then + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM + 4; // (1/1) + if SDL_ModState = KMOD_LCTRL then + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 25) + 1) / 25; // (1/100) + end; + + SDLK_MINUS: + begin + // Decrease BPM + if SDL_ModState = 0 then + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 5) - 1) / 5; + if SDL_ModState = KMOD_LSHIFT then + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM - 4; + if SDL_ModState = KMOD_LCTRL then + CurrentSong.BPM[0].BPM := Round((CurrentSong.BPM[0].BPM * 25) - 1) / 25; + end; + + SDLK_4: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Lines[0].Current); + CopySentence(CopySrc+1, Lines[0].Current+1); + CopySentence(CopySrc+2, Lines[0].Current+2); + CopySentence(CopySrc+3, Lines[0].Current+3); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Lines[0].Current, 4); + end; + end; + SDLK_5: + begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + CopySentence(CopySrc, Lines[0].Current); + CopySentence(CopySrc+1, Lines[0].Current+1); + CopySentence(CopySrc+2, Lines[0].Current+2); + CopySentence(CopySrc+3, Lines[0].Current+3); + CopySentence(CopySrc+4, Lines[0].Current+4); + end; + + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + CopySentences(CopySrc, Lines[0].Current, 5); + end; + end; + + SDLK_9: + begin + // Decrease GAP + if SDL_ModState = 0 then + CurrentSong.GAP := CurrentSong.GAP - 10; + if SDL_ModState = KMOD_LSHIFT then + CurrentSong.GAP := CurrentSong.GAP - 1000; + end; + SDLK_0: + begin + // Increase GAP + if SDL_ModState = 0 then + CurrentSong.GAP := CurrentSong.GAP + 10; + if SDL_ModState = KMOD_LSHIFT then + CurrentSong.GAP := CurrentSong.GAP + 1000; + end; + + SDLK_KP_PLUS: + begin + // Increase tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(12); + end; + + SDLK_KP_MINUS: + begin + // Decrease tone of all notes + if SDL_ModState = 0 then + ChangeWholeTone(-1); + if SDL_ModState = KMOD_LSHIFT then + ChangeWholeTone(-12); + end; + + SDLK_SLASH: + begin + if SDL_ModState = 0 then begin + // Insert start of sentece + if CurrentNote > 0 then + DivideSentence; + end; + + if SDL_ModState = KMOD_LSHIFT then begin + // Join next sentence with current + if Lines[0].Current < Lines[0].High then + JoinSentence; + end; + + if SDL_ModState = KMOD_LCTRL then begin + // divide note + DivideNote; + end; + + end; + + SDLK_F4: + begin + // Enter Text Edit Mode + TextEditMode := true; + end; + + SDLK_SPACE: + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + AudioPlayback.Stop; + AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + PlayStopTime := (GetTimeFromBeat( + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); + AudioPlayback.Play; + LastClick := -100; + end; + + SDLK_RETURN: + begin + end; + + SDLK_LCTRL: + begin + end; + + SDLK_DELETE: + begin + if SDL_ModState = KMOD_LCTRL then begin + // moves text to right in current sentence + DeleteNote; + end; + end; + + SDLK_PERIOD: + begin + // moves text to right in current sentence + MoveTextToRight; + end; + + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Inc(CurrentNote); + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lyric.Selected := CurrentNote; + end; + + // ctrl + right + if SDL_ModState = KMOD_LCTRL then begin + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + if CurrentNote = 0 then begin + Inc(Lines[0].Line[Lines[0].Current].Start); + end; + end; + end; + + // shift + right + if SDL_ModState = KMOD_LSHIFT then begin + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + if CurrentNote = 0 then begin + Inc(Lines[0].Line[Lines[0].Current].Start); + end; + if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then + Inc(Lines[0].Line[Lines[0].Current].End_); + end; + + // alt + right + if SDL_ModState = KMOD_LALT then begin + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then + Inc(Lines[0].Line[Lines[0].Current].End_); + end; + + // alt + ctrl + shift + right = move all from cursor to right + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(1); + end; + + end; + + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Dec(CurrentNote); + if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lyric.Selected := CurrentNote; + end; + + // ctrl + left + if SDL_ModState = KMOD_LCTRL then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + if CurrentNote = 0 then begin + Dec(Lines[0].Line[Lines[0].Current].Start); + end; + end; + + // shift + left + if SDL_ModState = KMOD_LSHIFT then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + + // resizing sentences + if CurrentNote = 0 then begin + Dec(Lines[0].Line[Lines[0].Current].Start); + end; + + if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then + Dec(Lines[0].Line[Lines[0].Current].End_); + + end; + + // alt + left + if SDL_ModState = KMOD_LALT then begin + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then + Dec(Lines[0].Line[Lines[0].Current].End_); + end; + end; + + // alt + ctrl + shift + right = move all from cursor to left + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + MoveAllToEnd(-1); + end; + + end; + + SDLK_DOWN: + begin + + // skip to next sentence + if SDL_ModState = 0 then begin {$IFDEF UseMIDIPort} + MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + PlaySentenceMidi := false; + {$endif} + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Inc(Lines[0].Current); + CurrentNote := 0; + if Lines[0].Current > Lines[0].High then Lines[0].Current := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := 0; + AudioPlayback.Stop; + PlaySentence := false; + end; + + // decrease tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(-1); + end; + + end; + + SDLK_UP: + begin + + // skip to previous sentence + if SDL_ModState = 0 then begin + {$IFDEF UseMIDIPort} + MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + PlaySentenceMidi := false; + {$endif} + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Dec(Lines[0].Current); + CurrentNote := 0; + if Lines[0].Current = -1 then Lines[0].Current := Lines[0].High; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := 0; + AudioPlayback.Stop; + PlaySentence := false; + end; + + // increase tone + if SDL_ModState = KMOD_LCTRL then begin + TransposeNote(1); + end; + end; + + end; // case + end; + end; // if +end; + +function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + SDL_ModState: Word; +begin + // used when in Text Edit Mode + Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE: + begin + FadeTo(@ScreenSong); + end; + SDLK_F4, SDLK_RETURN: + begin + // Exit Text Edit Mode + TextEditMode := false; + end; + SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: + begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text := + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text + CharCode; + end; + SDLK_BACKSPACE: + begin + Delete(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text, + Length(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text), 1); + end; + SDLK_RIGHT: + begin + // right + if SDL_ModState = 0 then begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Inc(CurrentNote); + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lyric.Selected := CurrentNote; + end; + end; + SDLK_LEFT: + begin + // left + if SDL_ModState = 0 then begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Dec(CurrentNote); + if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lyric.Selected := CurrentNote; + end; + end; + end; + end; +end; + +procedure TScreenEditSub.NewBeat; +begin + // click +{ for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNut do + if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = Czas.AktBeat) then begin + // old} +// Music.PlayClick; +end; + +procedure TScreenEditSub.DivideBPM; +var + C: integer; + N: integer; +begin + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM / 2; + for C := 0 to Lines[0].High do begin + Lines[0].Line[C].Start := Lines[0].Line[C].Start div 2; + Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; + for N := 0 to Lines[0].Line[C].HighNote do begin + Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; + Lines[0].Line[C].Note[N].Length := Round(Lines[0].Line[C].Note[N].Length / 2); + end; // N + end; // C +end; + +procedure TScreenEditSub.MultiplyBPM; +var + C: integer; + N: integer; +begin + CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM * 2; + for C := 0 to Lines[0].High do begin + Lines[0].Line[C].Start := Lines[0].Line[C].Start * 2; + Lines[0].Line[C].End_ := Lines[0].Line[C].End_ * 2; + for N := 0 to Lines[0].Line[C].HighNote do begin + Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start * 2; + Lines[0].Line[C].Note[N].Length := Lines[0].Line[C].Note[N].Length * 2; + end; // N + end; // C +end; + +procedure TScreenEditSub.LyricsCapitalize; +var + C: integer; + N: integer; // temporary + S: string; +begin + // temporary +{ for C := 0 to Lines[0].High do + for N := 0 to Lines[0].Line[C].HighNut do + Lines[0].Line[C].Note[N].Text := AnsiLowerCase(Lines[0].Line[C].Note[N].Text);} + + for C := 0 to Lines[0].High do begin + S := AnsiUpperCase(Copy(Lines[0].Line[C].Note[0].Text, 1, 1)); + S := S + Copy(Lines[0].Line[C].Note[0].Text, 2, Length(Lines[0].Line[C].Note[0].Text)-1); + Lines[0].Line[C].Note[0].Text := S; + end; // C +end; + +procedure TScreenEditSub.LyricsCorrectSpaces; +var + C: integer; + N: integer; +begin + for C := 0 to Lines[0].High do begin + // correct starting spaces in the first word + while Copy(Lines[0].Line[C].Note[0].Text, 1, 1) = ' ' do + Lines[0].Line[C].Note[0].Text := Copy(Lines[0].Line[C].Note[0].Text, 2, 100); + + // move spaces on the start to the end of the previous note + for N := 1 to Lines[0].Line[C].HighNote do begin + while (Copy(Lines[0].Line[C].Note[N].Text, 1, 1) = ' ') do begin + Lines[0].Line[C].Note[N].Text := Copy(Lines[0].Line[C].Note[N].Text, 2, 100); + Lines[0].Line[C].Note[N-1].Text := Lines[0].Line[C].Note[N-1].Text + ' '; + end; + end; // N + + // correct '-' to '- ' + for N := 0 to Lines[0].Line[C].HighNote do begin + if Lines[0].Line[C].Note[N].Text = '-' then + Lines[0].Line[C].Note[N].Text := '- '; + end; // N + + // add space to the previous note when the current word is '- ' + for N := 1 to Lines[0].Line[C].HighNote do begin + if Lines[0].Line[C].Note[N].Text = '- ' then + Lines[0].Line[C].Note[N-1].Text := Lines[0].Line[C].Note[N-1].Text + ' '; + end; // N + + // correct too many spaces at the end of note + for N := 0 to Lines[0].Line[C].HighNote do begin + while Copy(Lines[0].Line[C].Note[N].Text, Length(Lines[0].Line[C].Note[N].Text)-1, 2) = ' ' do + Lines[0].Line[C].Note[N].Text := Copy(Lines[0].Line[C].Note[N].Text, 1, Length(Lines[0].Line[C].Note[N].Text)-1); + end; // N + + // and correct if there is no space at the end of sentence + N := Lines[0].Line[C].HighNote; + if Copy(Lines[0].Line[C].Note[N].Text, Length(Lines[0].Line[C].Note[N].Text), 1) <> ' ' then + Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N].Text + ' '; + + end; // C +end; + +procedure TScreenEditSub.FixTimings; +var + C: integer; + S: integer; + Min: integer; + Max: integer; +begin + for C := 1 to Lines[0].High do begin + with Lines[0].Line[C-1] do begin + Min := Note[HighNote].Start + Note[HighNote].Length; + Max := Lines[0].Line[C].Note[0].Start; + case (Max - Min) of + 0: S := Max; + 1: S := Max; + 2: S := Max - 1; + 3: S := Max - 2; + else + if ((Max - Min) > 4) then + S := Min + 2 + else + S := Max; + end; // case + + Lines[0].Line[C].Start := S; + end; // with + end; // for +end; + +procedure TScreenEditSub.DivideSentence; +var + C: integer; + CStart: integer; + CNew: integer; + CLen: integer; + N: integer; + NStart: integer; + NHigh: integer; +begin + // increase sentence length by 1 + CLen := Length(Lines[0].Line); + SetLength(Lines[0].Line, CLen + 1); + Inc(Lines[0].Number); + Inc(Lines[0].High); + + // move needed sentences to one forward. newly has the copy of divided sentence + CStart := Lines[0].Current; + for C := CLen-1 downto CStart do + Lines[0].Line[C+1] := Lines[0].Line[C]; + + // clear and set new sentence + CNew := CStart + 1; + NStart := CurrentNote; + Lines[0].Line[CNew].Start := Lines[0].Line[CStart].Note[NStart].Start; + Lines[0].Line[CNew].Lyric := ''; + Lines[0].Line[CNew].LyricWidth := 0; + Lines[0].Line[CNew].End_ := 0; + Lines[0].Line[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure + Lines[0].Line[CNew].HighNote := -1; + SetLength(Lines[0].Line[CNew].Note, 0); + + // move right notes to new sentences + NHigh := Lines[0].Line[CStart].HighNote; + for N := NStart to NHigh do begin + // increase sentence counters + with Lines[0].Line[CNew] do + begin + Inc(HighNote); + SetLength(Note, HighNote + 1); + Note[HighNote] := Note[N]; + End_ := Note[HighNote].Start + Note[HighNote].Length; + + if Note[HighNote].Tone < BaseNote then + BaseNote := Note[HighNote].Tone; + end; + end; + + // clear old notes and set sentence counters + Lines[0].Line[CStart].HighNote := NStart - 1; + Lines[0].Line[CStart].End_ := Lines[0].Line[CStart].Note[NStart-1].Start + + Lines[0].Line[CStart].Note[NStart-1].Length; + SetLength(Lines[0].Line[CStart].Note, Lines[0].Line[CStart].HighNote + 1); + + Lines[0].Current := Lines[0].Current + 1; + CurrentNote := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lyric.AddLine(Lines[0].Current); +end; + +procedure TScreenEditSub.JoinSentence; +var + C: integer; + N: integer; + NStart: integer; + NDst: integer; +begin + C := Lines[0].Current; + + // set new sentence + NStart := Lines[0].Line[C].HighNote + 1; + Lines[0].Line[C].HighNote := Lines[0].Line[C].HighNote + Lines[0].Line[C+1].HighNote + 1; + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); + + // move right notes to new sentences + for N := 0 to Lines[0].Line[C+1].HighNote do begin + NDst := NStart + N; + Lines[0].Line[C].Note[NDst] := Lines[0].Line[C+1].Note[N]; + end; + + // increase sentence counters + NDst := Lines[0].Line[C].HighNote; + Lines[0].Line[C].End_ := Lines[0].Line[C].Note[NDst].Start + + Lines[0].Line[C].Note[NDst].Length; + + // move needed sentences to one backward. + for C := Lines[0].Current + 1 to Lines[0].High - 1 do + Lines[0].Line[C] := Lines[0].Line[C+1]; + + // increase sentence length by 1 + SetLength(Lines[0].Line, Length(Lines[0].Line) - 1); + Dec(Lines[0].Number); + Dec(Lines[0].High); +end; + +procedure TScreenEditSub.DivideNote; +var + C: integer; + N: integer; +begin + C := Lines[0].Current; + + with Lines[0].Line[C] do + begin + Inc(HighNote); + SetLength(Note, HighNote + 1); + + // we copy all notes including selected one + for N := HighNote downto CurrentNote+1 do begin + Note[N] := Note[N-1]; + end; + + // me slightly modify new note + Note[CurrentNote].Length := 1; + Inc(Note[CurrentNote+1].Start); + Dec(Note[CurrentNote+1].Length); + Note[CurrentNote+1].Text := '- '; + Note[CurrentNote+1].Color := 0; + end; +end; + +procedure TScreenEditSub.DeleteNote; +var + C: integer; + N: integer; + NLen: integer; +begin + C := Lines[0].Current; + + //Do Not delete Last Note + if (Lines[0].High > 0) OR (Lines[0].Line[C].HighNote > 0) then + begin + + // we copy all notes from the next to the selected one + for N := CurrentNote+1 to Lines[0].Line[C].HighNote do begin + Lines[0].Line[C].Note[N-1] := Lines[0].Line[C].Note[N]; + end; + + Dec(Lines[0].Line[C].HighNote); + if (Lines[0].Line[C].HighNote >= 0) then + begin + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); + + // me slightly modify new note + if CurrentNote > Lines[0].Line[C].HighNote then + Dec(CurrentNote); + + Lines[0].Line[C].Note[CurrentNote].Color := 1; + end + //Last Note of current Sentence Deleted - > Delete Sentence + else + begin + //Move all Sentences after the current to the Left + for N := C+1 to Lines[0].High do + Lines[0].Line[N-1] := Lines[0].Line[N]; + + //Delete Last Sentence + SetLength(Lines[0].Line, Lines[0].High); + Lines[0].High := High(Lines[0].Line); + Lines[0].Number := Length(Lines[0].Line); + + CurrentNote := 0; + if (C > 0) then + Lines[0].Current := C - 1 + else + Lines[0].Current := 0; + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + end; + end; +end; + +procedure TScreenEditSub.TransposeNote(Transpose: integer); +begin + Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone, Transpose); +end; + +procedure TScreenEditSub.ChangeWholeTone(Tone: integer); +var + C: integer; + N: integer; +begin + for C := 0 to Lines[0].High do begin + Lines[0].Line[C].BaseNote := Lines[0].Line[C].BaseNote + Tone; + for N := 0 to Lines[0].Line[C].HighNote do + Lines[0].Line[C].Note[N].Tone := Lines[0].Line[C].Note[N].Tone + Tone; + end; +end; + +procedure TScreenEditSub.MoveAllToEnd(Move: integer); +var + C: integer; + N: integer; + NStart: integer; +begin + for C := Lines[0].Current to Lines[0].High do begin + NStart := 0; + if C = Lines[0].Current then NStart := CurrentNote; + for N := NStart to Lines[0].Line[C].HighNote do begin + Inc(Lines[0].Line[C].Note[N].Start, Move); // move note start + + if N = 0 then begin // fix beginning + Inc(Lines[0].Line[C].Start, Move); + end; + + if N = Lines[0].Line[C].HighNote then // fix ending + Inc(Lines[0].Line[C].End_, Move); + + end; // for + end; // for +end; + +procedure TScreenEditSub.MoveTextToRight; +var + C: integer; + N: integer; + NHigh: integer; +begin +{ C := Lines[0].Current; + + for N := Lines[0].Line[C].HighNut downto 1 do begin + Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N-1].Text; + end; // for + + Lines[0].Line[C].Note[0].Text := '- ';} + + C := Lines[0].Current; + NHigh := Lines[0].Line[C].HighNote; + + // last word + Lines[0].Line[C].Note[NHigh].Text := Lines[0].Line[C].Note[NHigh-1].Text + Lines[0].Line[C].Note[NHigh].Text; + + // other words + for N := NHigh - 1 downto CurrentNote + 1 do begin + Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N-1].Text; + end; // for + Lines[0].Line[C].Note[CurrentNote].Text := '- '; +end; + +procedure TScreenEditSub.MarkSrc; +begin + CopySrc := Lines[0].Current; +end; + +procedure TScreenEditSub.PasteText; +var + C: integer; + N: integer; +begin + C := Lines[0].Current; + + for N := 0 to Lines[0].Line[CopySrc].HighNote do + Lines[0].Line[C].Note[N].Text := Lines[0].Line[CopySrc].Note[N].Text; +end; + +procedure TScreenEditSub.CopySentence(Src, Dst: integer); +var + N: integer; + Time1: integer; + Time2: integer; + TD: integer; +begin + Time1 := Lines[0].Line[Src].Note[0].Start; + Time2 := Lines[0].Line[Dst].Note[0].Start; + TD := Time2-Time1; + + SetLength(Lines[0].Line[Dst].Note, Lines[0].Line[Src].HighNote + 1); + Lines[0].Line[Dst].HighNote := Lines[0].Line[Src].HighNote; + for N := 0 to Lines[0].Line[Src].HighNote do begin + Lines[0].Line[Dst].Note[N].Text := Lines[0].Line[Src].Note[N].Text; + Lines[0].Line[Dst].Note[N].Length := Lines[0].Line[Src].Note[N].Length; + Lines[0].Line[Dst].Note[N].Tone := Lines[0].Line[Src].Note[N].Tone; + Lines[0].Line[Dst].Note[N].Start := Lines[0].Line[Src].Note[N].Start + TD; + end; + N := Lines[0].Line[Src].HighNote; + Lines[0].Line[Dst].End_ := Lines[0].Line[Dst].Note[N].Start + Lines[0].Line[Dst].Note[N].Length; +end; + +procedure TScreenEditSub.CopySentences(Src, Dst, Num: integer); +var + C: integer; +begin + // create place for new sentences + SetLength(Lines[0].Line, Lines[0].Number + Num - 1); + + // moves sentences next to the destination + for C := Lines[0].High downto Dst + 1 do begin + Lines[0].Line[C + Num - 1] := Lines[0].Line[C]; + end; + + // prepares new sentences: sets sentence start and create first note + for C := 1 to Num-1 do begin + Lines[0].Line[Dst + C].Start := Lines[0].Line[Dst + C - 1].Note[0].Start + + (Lines[0].Line[Src + C].Note[0].Start - Lines[0].Line[Src + C - 1].Note[0].Start); + SetLength(Lines[0].Line[Dst + C].Note, 1); + Lines[0].Line[Dst + C].HighNote := 0; + Lines[0].Line[Dst + C].Note[0].Start := Lines[0].Line[Dst + C].Start; + Lines[0].Line[Dst + C].Note[0].Length := 1; + Lines[0].Line[Dst + C].End_ := Lines[0].Line[Dst + C].Start + 1; + end; + + // increase counters + Lines[0].Number := Lines[0].Number + Num - 1; + Lines[0].High := Lines[0].High + Num - 1; + + for C := 0 to Num-1 do + CopySentence(Src + C, Dst + C); +end; + + +constructor TScreenEditSub.Create; +begin + inherited Create; + SetLength(Player, 1); + + // linijka + AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); + AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // Note + AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); + AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); + TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); + + // file info + AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); + AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); + AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); + AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); + AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); + AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:'); + AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:'); + + TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a'); + TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b'); + TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c'); + TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd'); + TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e'); + +{ AddInteraction(2, TextTitle); + AddInteraction(2, TextArtist); + AddInteraction(2, TextMp3); + AddInteraction(2, TextBPM); + AddInteraction(2, TextGAP);} + + // note info + AddText(20, 190, 0, 8, 0, 0, 0, 'Start:'); + AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:'); + AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:'); + AddText(20, 265, 0, 8, 0, 0, 0, 'Text:'); + + TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a'); + TextNLength := AddText(120, 215, 0, 8, 0, 0, 0, 'b'); + TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c'); + TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd'); + + // debug + TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); + +end; + +procedure TScreenEditSub.onShow; +begin + inherited; + + Log.LogStatus('Initializing', 'TEditScreen.onShow'); + Lyric := TEditorLyrics.Create; + + ResetSingTemp; + + try + //Check if File is XML + if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' + then Error := not CurrentSong.LoadXMLSong() + else Error := not CurrentSong.LoadSong(); + except + Error := True; + end; + + if Error then + begin + //Error Loading Song -> Go back to Song Screen and Show some Error Message + FadeTo(@ScreenSong); + ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); + Exit; + end + else begin + {$IFDEF UseMIDIPort} + MidiOut := TMidiOutput.Create(nil); + if Ini.Debug = 1 then + MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table + MidiOut.Open; + {$ENDIF} + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextMp3].Text := CurrentSong.Mp3; + + Lines[0].Current := 0; + CurrentNote := 0; + Lines[0].Line[0].Note[0].Color := 1; + AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3); + //Set Down Music Volume for Better hearability of Midi Sounds + //Music.SetVolume(0.4); + + Lyric.Clear; + Lyric.X := 400; + Lyric.Y := 500; + Lyric.Align := 1; + Lyric.Size := 14; + Lyric.ColR := 0; + Lyric.ColG := 0; + Lyric.ColB := 0; + Lyric.ColSR := Skin_FontHighlightR; + Lyric.ColSG := Skin_FontHighlightG; + Lyric.ColSB := Skin_FontHighlightB; + Lyric.AddLine(0); + Lyric.Selected := 0; + + NotesH := 7; + NotesW := 4; + + end; + +// Interaction := 0; + TextEditMode := false; +end; + +function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + glClearColor(1,1,1,1); + + // midi music + if PlaySentenceMidi then begin + {$IFDEF UseMIDIPort} + MidiPos := USTime.GetTime - MidiTime + MidiStart; + + + // stop the music + if (MidiPos > MidiStop) then begin + MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + PlaySentenceMidi := false; + end; + {$ENDIF} + + // click + AktBeat := Floor(GetMidBeat(MidiPos - CurrentSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + + if AktBeat <> LastClick then begin + for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNote do + if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then + begin + + + LastClick := AktBeat; + {$IFDEF UseMIDIPort} + if Pet > 0 then + MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[Pet-1].Tone + 60, 127); + MidiOut.PutShort($91, Lines[0].Line[Lines[0].Current].Note[Pet].Tone + 60, 127); + MidiLastNote := Pet; + {$ENDIF} + + end; + end; + end; // if PlaySentenceMidi + + // mp3 music + if PlaySentence then begin + // stop the music + if (AudioPlayback.Position > PlayStopTime) then + begin + AudioPlayback.Stop; + PlaySentence := false; + end; + + // click + if (Click) and (PlaySentence) then begin +// AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); + Text[TextDebug].Text := IntToStr(AktBeat); + if AktBeat <> LastClick then begin + for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNote do + if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then + begin + AudioPlayback.PlaySound( SoundLib.Click ); + LastClick := AktBeat; + end; + end; + end; // click + end; // if PlaySentence + + + Text[TextSentence].Text := IntToStr(Lines[0].Current + 1) + ' / ' + IntToStr(Lines[0].Number); + Text[TextNote].Text := IntToStr(CurrentNote + 1) + ' / ' + IntToStr(Lines[0].Line[Lines[0].Current].HighNote + 1); + + // Song info + Text[TextBPM].Text := FloatToStr(CurrentSong.BPM[0].BPM / 4); + Text[TextGAP].Text := FloatToStr(CurrentSong.GAP); + + //Error reading Variables when no Song is loaded + if not Error then + begin + // Note info + Text[TextNStart].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + Text[TextNLength].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + Text[TextNTon].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' ( ' + GetNoteName(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' )'; + Text[TextNText].Text := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; + end; + + // Text Edit Mode + if TextEditMode then + Text[TextNText].Text := Text[TextNText].Text + '|'; + + // draw static menu + inherited Draw; + + // draw notes + SingDrawNoteLines(20, 300, 780, 15); + //Error Drawing when no Song is loaded + if not Error then + begin + SingDrawBeatDelimeters(40, 300, 760, 0); + EditDrawLine(40, 405, 760, 0, 15); + end; + + // draw text + Lyric.Draw; + + Result := true; +end; + +procedure TScreenEditSub.onHide; +begin + {$IFDEF UseMIDIPort} + MidiOut.Close; + MidiOut.Free; + {$ENDIF} + Lyric.Free; + //Music.SetVolume(1.0); +end; + +function TScreenEditSub.GetNoteName(Note: Integer): String; +var N1, N2: Integer; +begin + if (Note > 0) then + begin + N1 := Note mod 12; + N2 := Note div 12; + end + else + begin + N1 := (Note + (-Trunc(Note/12)+1)*12) mod 12; + N2 := -1; + end; + + + + case N1 of + 0: Result := 'c'; + 1: Result := 'c#'; + 2: Result := 'd'; + 3: Result := 'd#'; + 4: Result := 'e'; + 5: Result := 'f'; + 6: Result := 'f#'; + 7: Result := 'g'; + 8: Result := 'g#'; + 9: Result := 'a'; + 10: Result := 'b'; + 11: Result := 'h'; + end; + + case N2 of + 0: Result := UpperCase(Result); //Normal Uppercase Note, 1: Normal lowercase Note + 2: Result := Result + ''''; //One Striped + 3: Result := Result + ''''''; //Two Striped + 4: Result := Result + ''''''''; //etc. + 5: Result := Result + ''''''''''; + 6: Result := Result + ''''''''''''; + 7: Result := Result + ''''''''''''''; + end; +end; + +end. diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas new file mode 100644 index 00000000..1ea79e7f --- /dev/null +++ b/src/screens/UScreenLevel.pas @@ -0,0 +1,103 @@ +unit UScreenLevel; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenLevel = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, + UMain, + UIni, + USong, + UTexture; + +function TScreenLevel.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenName); + end; + + SDLK_RETURN: + begin + Ini.Difficulty := Interaction; + Ini.SaveLevel; + AudioPlayback.PlaySound(SoundLib.Start); + //Set Standard Mode + ScreenSong.Mode := smNormal; + FadeTo(@ScreenSong); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenLevel.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + LoadFromTheme(Theme.Level); + + AddButton(Theme.Level.ButtonEasy); + AddButton(Theme.Level.ButtonMedium); + AddButton(Theme.Level.ButtonHard); + + Interaction := 0; +end; + +procedure TScreenLevel.onShow; +begin + inherited; + + Interaction := Ini.Difficulty; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenLevel.SetAnimationProgress(Progress: real); +begin + Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; +end; + +end. diff --git a/src/screens/UScreenLoading.pas b/src/screens/UScreenLoading.pas new file mode 100644 index 00000000..ee3c6f7f --- /dev/null +++ b/src/screens/UScreenLoading.pas @@ -0,0 +1,57 @@ +unit UScreenLoading; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + SysUtils, + UThemes, + gl; + +type + TScreenLoading = class(TMenu) + public + Fadeout: boolean; + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function GetBGTexNum: GLUInt; + end; + +implementation + +uses UGraphic, + UTime; + +function TScreenLoading.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; +end; + +constructor TScreenLoading.Create; +begin + inherited Create; + + LoadFromTheme(Theme.Loading); + + Fadeout := false; +end; + +procedure TScreenLoading.onShow; +begin + inherited; +end; + +function TScreenLoading.GetBGTexNum: GLUInt; +begin + Result := Self.BackImg.TexNum; +end; + +end. diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas new file mode 100644 index 00000000..4dbdaaa1 --- /dev/null +++ b/src/screens/UScreenMain.pas @@ -0,0 +1,256 @@ +unit UScreenMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; + +type + TScreenMain = class(TMenu) + public + TextDescription: integer; + TextDescriptionLong: integer; + + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses + UGraphic, + UMain, + UIni, + UTexture, + USongs, + Textgl, + ULanguage, + UParty, + UDLLManager, + UScreenCredits, + USkins; + +function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; +var + SDL_ModState: word; +begin + Result := True; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + if (PressedDown) then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := False; + Exit; + end; + 'C': + begin + if (SDL_ModState = KMOD_LALT) then + begin + FadeTo(@ScreenCredits, SoundLib.Start); + Exit; + end; + end; + 'M': + begin + if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then + begin + FadeTo(@ScreenPartyOptions, SoundLib.Start); + Exit; + end; + end; + + 'S': + begin + FadeTo(@ScreenStatMain, SoundLib.Start); + Exit; + end; + + 'E': + begin + FadeTo(@ScreenEdit, SoundLib.Start); + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + Result := False; + end; + + SDLK_RETURN: + begin + //Solo + if (Interaction = 0) then + begin + if (Songs.SongList.Count >= 1) then + begin + 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, SoundLib.Start); + end + else //show error message + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); + end; + + //Multi + if Interaction = 1 then + begin + if (Songs.SongList.Count >= 1) then + begin + if (Length(DLLMan.Plugins) >= 1) then + begin + FadeTo(@ScreenPartyOptions, SoundLib.Start); + 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 + FadeTo(@ScreenStatMain, SoundLib.Start); + end; + + //Editor + if Interaction = 3 then + begin + FadeTo(@ScreenEdit, SoundLib.Start); + end; + + //Options + if Interaction = 4 then + begin + FadeTo(@ScreenOptions, SoundLib.Start); + 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; +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 + inherited; +{** + * Start background music + *} + SoundLib.StartBgMusic; +end; + +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; + +end. diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas new file mode 100644 index 00000000..f2d59f05 --- /dev/null +++ b/src/screens/UScreenName.pas @@ -0,0 +1,243 @@ +unit UScreenName; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenName = class(TMenu) + public + Goto_SingScreen: Boolean; //If True then next Screen in SingScreen + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture, UCommon; + + +function TScreenName.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + I: integer; +SDL_ModState: Word; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + // check normal keys + if (IsAlphaNumericChar(CharCode) or + {(CharCode in [' ','-','_','!',',','<','/','*','?','''','"']))} IsPunctuationChar(CharCode)) then + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; + Exit; + end; + + // check special keys + case PressedKey of + // Templates for Names Mod + SDLK_F1: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + end; + + SDLK_ESCAPE : + begin + Ini.SaveNames; + AudioPlayback.PlaySound(SoundLib.Back); + if GoTo_SingScreen then + FadeTo(@ScreenSong) + else + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + for I := 1 to 6 do + Ini.Name[I-1] := Button[I-1].Text[0].Text; + Ini.SaveNames; + AudioPlayback.PlaySound(SoundLib.Start); + + if GoTo_SingScreen then + FadeTo(@ScreenSing) + else + FadeTo(@ScreenLevel); + + GoTo_SingScreen := False; + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenName.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Name); + + + for I := 1 to 6 do + AddButton(Theme.Name.ButtonPlayer[I]); + + Interaction := 0; +end; + +procedure TScreenName.onShow; +var + I: integer; +begin + inherited; + + for I := 1 to 6 do + Button[I-1].Text[0].Text := Ini.Name[I-1]; + + for I := 1 to PlayersPlay do begin + Button[I-1].Visible := true; + Button[I-1].Selectable := true; + end; + + for I := PlayersPlay+1 to 6 do begin + Button[I-1].Visible := false; + Button[I-1].Selectable := false; + end; + +end; + +procedure TScreenName.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 1 to 6 do + Button[I-1].Texture.ScaleW := Progress; +end; + +end. diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas new file mode 100644 index 00000000..186b9b47 --- /dev/null +++ b/src/screens/UScreenOpen.pas @@ -0,0 +1,173 @@ +unit UScreenOpen; + +interface + +{$I switches.inc} + +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, + ULyrics, Math, gl, UThemes; + +type + TScreenOpen = class(TMenu) + private + TextF: array[0..1] of integer; + TextN: integer; + public + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + BackScreen: pointer; + procedure AddBox(X, Y, W, H: real); + constructor Create; override; + procedure onShow; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; +// function Draw: boolean; override; +// procedure Finish; + end; + +implementation +uses UGraphic, UDraw, UMain, USkins; + +function TScreenOpen.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + + if (PressedDown) then begin // Key Down + // check normal keys + case CharCode of + '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '.', ':', '\': + begin + if Interaction = 0 then begin + Text[TextN].Text := Text[TextN].Text + CharCode; + end; + end; + end; + + // check special keys + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + 8: // del + begin + if Interaction = 0 then + begin + Text[TextN].DeleteLastL; + end; + end; + + + SDLK_ESCAPE : + begin + //Empty Filename and go to last Screen + ConversionFileName := ''; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(BackScreen); + end; + + SDLK_RETURN: + begin + if (Interaction = 2) then begin + //Update Filename and go to last Screen + ConversionFileName := Text[TextN].Text; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(BackScreen); + end + else if (Interaction = 1) then + begin + //Empty Filename and go to last Screen + ConversionFileName := ''; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(BackScreen); + end; + end; + + SDLK_LEFT: + begin + InteractPrev; + end; + + SDLK_RIGHT: + begin + InteractNext; + end; + + SDLK_DOWN: + begin + end; + + SDLK_UP: + begin + end; + end; + end; +end; + +procedure TScreenOpen.AddBox(X, Y, W, H: real); +begin + AddStatic(X, Y, W, H, 0, 0, 0, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); + AddStatic(X+2, Y+2, W-4, H-4, 1, 1, 1, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); +end; + +constructor TScreenOpen.Create; +begin + inherited Create; + + // linijka +{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); + AddText(35, 17, 1, 6, 1, 1, 1, 'Linijka'); + TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');} + + // file list +// AddBox(400, 100, 350, 450); + +// TextF[0] := AddText(430, 155, 0, 8, 0, 0, 0, 'a'); +// TextF[1] := AddText(430, 180, 0, 8, 0, 0, 0, 'a'); + + // file name + AddBox(20, 540, 500, 40); + TextN := AddText(50, 548, 0, 8, 0, 0, 0, ConversionFileName); + AddInteraction(iText, TextN); + + // buttons + {AddButton(540, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); + AddButtonText(30, 5, 0, 0, 0, 'OK');} + // buttons + AddButton(540, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(10, 5, 0, 0, 0, 'Cancel'); + + AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); + AddButtonText(30, 5, 0, 0, 0, 'OK'); + + +end; + +procedure TScreenOpen.onShow; +begin + inherited; + + Interaction := 0; +end; + +(*function TScreenEditSub.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Pet: integer; + AktBeat: integer; +begin + +end; + +procedure TScreenEditSub.Finish; +begin +// +end;*) + +end. + diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas new file mode 100644 index 00000000..24633115 --- /dev/null +++ b/src/screens/UScreenOptions.pas @@ -0,0 +1,196 @@ +unit UScreenOptions; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptions = class(TMenu) + public + TextDescription: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractNextRow; override; + procedure InteractPrevRow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic; + +function TScreenOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin +// Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + if SelInteraction = 0 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsGame); + end; + + if SelInteraction = 1 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsGraphics); + end; + + if SelInteraction = 2 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsSound); + end; + + if SelInteraction = 3 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsLyrics); + end; + + if SelInteraction = 4 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsThemes); + end; + + if SelInteraction = 5 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsRecord); + end; + + if SelInteraction = 6 then + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenOptionsAdvanced); + end; + + if SelInteraction = 7 then + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end; + end; + SDLK_DOWN: InteractNextRow; + SDLK_UP: InteractPrevRow; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenOptions.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + TextDescription := AddText(Theme.Options.TextDescription); + + LoadFromTheme(Theme.Options); + + AddButton(Theme.Options.ButtonGame); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[0]); + + AddButton(Theme.Options.ButtonGraphics); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[1]); + + AddButton(Theme.Options.ButtonSound); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[2]); + + AddButton(Theme.Options.ButtonLyrics); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[3]); + + AddButton(Theme.Options.ButtonThemes); + if (Length(Button[4].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[4]); + + AddButton(Theme.Options.ButtonRecord); + if (Length(Button[5].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[5]); + + AddButton(Theme.Options.ButtonAdvanced); + if (Length(Button[6].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[6]); + + AddButton(Theme.Options.ButtonExit); + if (Length(Button[7].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptions.onShow; +begin + inherited; +end; + +procedure TScreenOptions.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractNextRow; +begin + inherited InteractNextRow; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.InteractPrevRow; +begin + inherited InteractPrevRow; + Text[TextDescription].Text := Theme.Options.Description[Interaction]; +end; + +procedure TScreenOptions.SetAnimationProgress(Progress: real); +begin + Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; + Button[3].Texture.ScaleW := Progress; + Button[4].Texture.ScaleW := Progress; + Button[5].Texture.ScaleW := Progress; + Button[6].Texture.ScaleW := Progress; + Button[7].Texture.ScaleW := Progress; +end; + +end. diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas new file mode 100644 index 00000000..be8895e1 --- /dev/null +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -0,0 +1,113 @@ +unit UScreenOptionsAdvanced; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsAdvanced = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, SysUtils; + +function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + // Escape -> save nothing - just leave this screen + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + //SelectLoadAnimation Hidden because it is useless atm + //if SelInteraction = 7 then begin + if SelInteraction = 6 then begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + //SelectLoadAnimation Hidden because it is useless atm + //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsAdvanced.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + LoadFromTheme(Theme.OptionsAdvanced); + + //SelectLoadAnimation Hidden because it is useless atm + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); + AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel); + AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); + + AddButton(Theme.OptionsAdvanced.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsAdvanced.onShow; +begin + inherited; + + Interaction := 0; +end; + +end. diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas new file mode 100644 index 00000000..2dc8dd7f --- /dev/null +++ b/src/screens/UScreenOptionsGame.pas @@ -0,0 +1,117 @@ +unit UScreenOptionsGame; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; + +type + TScreenOptionsGame = class(TMenu) + public + old_Tabs, old_Sorting: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure RefreshSongs; + end; + +implementation + +uses UGraphic, SysUtils; + +function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + RefreshSongs; + + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 6 then begin + AudioPlayback.PlaySound(SoundLib.Back); + RefreshSongs; + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGame.Create; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsGame); + + //Refresh Songs Patch + old_Sorting := Ini.Sorting; + old_Tabs := Ini.Tabs; + + AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); + AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + + AddButton(Theme.OptionsGame.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + +end; + +//Refresh Songs Patch +procedure TScreenOptionsGame.RefreshSongs; +begin +if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + ScreenSong.Refresh; +end; + +procedure TScreenOptionsGame.onShow; +begin + inherited; + +// Interaction := 0; +end; + +end. diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas new file mode 100644 index 00000000..f2b6faa2 --- /dev/null +++ b/src/screens/UScreenOptionsGraphics.pas @@ -0,0 +1,113 @@ +unit UScreenOptionsGraphics; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsGraphics = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UMain, SysUtils, TypInfo; + +function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + // Escape -> save nothing - just leave this screen + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin +{ if SelInteraction <= 1 then begin + Restart := true; + end;} + if SelInteraction = 6 then begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + // FIXME: changing the video mode does not work this way in windows + // and MacOSX as all textures will be invalidated through this. + // See the ALT+TAB code too. + {$IFDEF Linux} + Reinitialize3D(); + {$ENDIF} + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsGraphics.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + LoadFromTheme(Theme.OptionsGraphics); + + AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); + AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); + AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); + + + AddButton(Theme.OptionsGraphics.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + +end; + +procedure TScreenOptionsGraphics.onShow; +begin + inherited; + + Interaction := 0; +end; + +end. diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas new file mode 100644 index 00000000..42f1fadb --- /dev/null +++ b/src/screens/UScreenOptionsLyrics.pas @@ -0,0 +1,103 @@ +unit UScreenOptionsLyrics; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsLyrics = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, SysUtils; + +function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + // Escape -> save nothing - just leave this screen + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; +end; + +constructor TScreenOptionsLyrics.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + LoadFromTheme(Theme.OptionsLyrics); + + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); + //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!! + AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); + + + AddButton(Theme.OptionsLyrics.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + +end; + +procedure TScreenOptionsLyrics.onShow; +begin + inherited; + + Interaction := 0; +end; + +end. diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas new file mode 100644 index 00000000..885f7db5 --- /dev/null +++ b/src/screens/UScreenOptionsRecord.pas @@ -0,0 +1,785 @@ +unit UScreenOptionsRecord; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UThemes, + UMusic, + URecord, + UMenu; + +type + TDrawState = record + ChannelIndex: integer; + R, G, B: real; // mapped player color (normal) + RD, GD, BD: real; // mapped player color (dark) + end; + + TPeakInfo = record + Volume: single; + Time: cardinal; + end; + + TScreenOptionsRecord = class(TMenu) + private + // max. count of input-channels determined for all devices + MaxChannelCount: integer; + + // current input device + CurrentDeviceIndex: integer; + PreviewDeviceIndex: integer; + + // string arrays for select-slide options + InputSourceNames: array of string; + InputDeviceNames: array of string; + + // dynamic generated themes for channel select-sliders + SelectSlideChannelTheme: array of TThemeSelectSlide; + + // indices for widget-updates + SelectInputSourceID: integer; + SelectSlideChannelID: array of integer; + + // interaction IDs + ExitButtonIID: integer; + + // dummy data for non-available channels + ChannelToPlayerMapDummy: integer; + + // preview channel-buffers + PreviewChannel: array of TCaptureBuffer; + ChannelPeak: array of TPeakInfo; + + // Device source volume + SourceVolume: single; + NextVolumePollTime: cardinal; + + procedure StartPreview; + procedure StopPreview; + procedure UpdateInputDevice; + procedure ChangeVolume(VolumeChange: single); + procedure DrawVolume(x, y, Width, Height: single); + procedure DrawVUMeter(const State: TDrawState; x, y, Width, Height: single); + procedure DrawPitch(const State: TDrawState; x, y, Width, Height: single); + public + constructor Create; override; + function Draw: boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + end; + +const + PeakDecay = 0.2; // strength of peak-decay (reduction after one sec) + +const + BarHeight = 11; // height of each bar (volume/vu-meter/pitch) + BarUpperSpacing = 1; // spacing between a bar-area and the previous widget + BarLowerSpacing = 3; // spacing between a bar-area and the next widget + SourceBarsTotalHeight = BarHeight + BarUpperSpacing + BarLowerSpacing; + ChannelBarsTotalHeight = 2*BarHeight + BarUpperSpacing + BarLowerSpacing; + +implementation + +uses + SysUtils, + Math, + SDL, + gl, + TextGL, + UGraphic, + UDraw, + UMain, + UMenuSelectSlide, + UMenuText, + UFiles, + UDisplay, + UIni, + ULog; + +function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + '+': + begin + // FIXME: add a nice volume-slider instead + // or at least provide visualization and acceleration if the user holds the key pressed. + ChangeVolume(0.02); + end; + '-': + begin + // FIXME: add a nice volume-slider instead + // or at least provide visualization and acceleration if the user holds the key pressed. + ChangeVolume(-0.02); + end; + 'T': + begin + if ((SDL_GetModState() and KMOD_SHIFT) <> 0) then + Ini.ThresholdIndex := (Ini.ThresholdIndex + Length(IThresholdVals) - 1) mod Length(IThresholdVals) + else + Ini.ThresholdIndex := (Ini.ThresholdIndex + 1) mod Length(IThresholdVals); + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + // Escape -> save nothing - just leave this screen + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if (SelInteraction = ExitButtonIID) then + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction < ExitButtonIID) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + UpdateInputDevice; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction < ExitButtonIID) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + UpdateInputDevice; + end; + end; + end; +end; + +constructor TScreenOptionsRecord.Create; +var + DeviceIndex: integer; + SourceIndex: integer; + ChannelIndex: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; + ChannelTheme: ^TThemeSelectSlide; + //ButtonTheme: TThemeButton; + WidgetYPos: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsRecord); + + // set CurrentDeviceIndex to a valid device + if (Length(AudioInputProcessor.DeviceList) > 0) then + CurrentDeviceIndex := 0 + else + CurrentDeviceIndex := -1; + + PreviewDeviceIndex := -1; + + WidgetYPos := 0; + + // init sliders if at least one device was detected + if (Length(AudioInputProcessor.DeviceList) > 0) then + begin + InputDevice := AudioInputProcessor.DeviceList[CurrentDeviceIndex]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + // init device-selection slider + SetLength(InputDeviceNames, Length(AudioInputProcessor.DeviceList)); + for DeviceIndex := 0 to High(AudioInputProcessor.DeviceList) do + begin + InputDeviceNames[DeviceIndex] := AudioInputProcessor.DeviceList[DeviceIndex].Name; + end; + // add device-selection slider (InteractionID: 0) + AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, CurrentDeviceIndex, InputDeviceNames); + + // init source-selection slider + SetLength(InputSourceNames, Length(InputDevice.Source)); + for SourceIndex := 0 to High(InputDevice.Source) do + begin + InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name; + end; + // add source-selection slider (InteractionID: 1) + SelectInputSourceID := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, + InputDeviceCfg.Input, InputSourceNames); + + // add space for source volume bar + WidgetYPos := Theme.OptionsRecord.SelectSlideInput.Y + + Theme.OptionsRecord.SelectSlideInput.H + + SourceBarsTotalHeight; + + // find max. channel count of all devices + MaxChannelCount := 0; + for DeviceIndex := 0 to High(AudioInputProcessor.DeviceList) do + begin + if (AudioInputProcessor.DeviceList[DeviceIndex].AudioFormat.Channels > MaxChannelCount) then + MaxChannelCount := AudioInputProcessor.DeviceList[DeviceIndex].AudioFormat.Channels; + end; + + // init channel-to-player mapping sliders + SetLength(SelectSlideChannelID, MaxChannelCount); + SetLength(SelectSlideChannelTheme, MaxChannelCount); + + for ChannelIndex := 0 to MaxChannelCount-1 do + begin + // copy reference slide + SelectSlideChannelTheme[ChannelIndex] := + Theme.OptionsRecord.SelectSlideChannel; + // set current channel-theme + ChannelTheme := @SelectSlideChannelTheme[ChannelIndex]; + // adjust vertical position + ChannelTheme.Y := WidgetYPos; + // calc size of next slide (add space for bars) + WidgetYPos := WidgetYPos + ChannelTheme.H + ChannelBarsTotalHeight; + // append channel index to name + ChannelTheme.Text := ChannelTheme.Text + IntToStr(ChannelIndex+1); + + // show/hide widgets depending on whether the channel exists + if (ChannelIndex < Length(InputDeviceCfg.ChannelToPlayerMap)) then + begin + // current device has this channel + + // add slider + SelectSlideChannelID[ChannelIndex] := AddSelectSlide(ChannelTheme^, + InputDeviceCfg.ChannelToPlayerMap[ChannelIndex], IChannelPlayer); + end + else + begin + // current device does not have that many channels + + // add slider but hide it and assign a dummy variable to it + SelectSlideChannelID[ChannelIndex] := AddSelectSlide(ChannelTheme^, + ChannelToPlayerMapDummy, IChannelPlayer); + SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := false; + end; + end; + end; + + // add Exit-button + //ButtonTheme := Theme.OptionsRecord.ButtonExit; + // adjust button position + //if (WidgetYPos <> 0) then + // ButtonTheme.Y := WidgetYPos; + //AddButton(ButtonTheme); + // I uncommented the stuff above, because it's not skinable :X + AddButton(Theme.OptionsRecord.ButtonExit); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + // store InteractionID + if (Length(AudioInputProcessor.DeviceList) > 0) then + ExitButtonIID := MaxChannelCount + 2 + else + ExitButtonIID := 0; + + // set focus + Interaction := 0; +end; + +procedure TScreenOptionsRecord.UpdateInputDevice; +var + SourceIndex: integer; + InputDevice: TAudioInputDevice; + InputDeviceCfg: PInputDeviceConfig; + ChannelIndex: integer; +begin + //Log.LogStatus('Update input-device', 'TScreenOptionsRecord.UpdateCard') ; + + StopPreview(); + + // set CurrentDeviceIndex to a valid device + if (CurrentDeviceIndex > High(AudioInputProcessor.DeviceList)) then + CurrentDeviceIndex := 0; + + // update sliders if at least one device was detected + if (Length(AudioInputProcessor.DeviceList) > 0) then + begin + InputDevice := AudioInputProcessor.DeviceList[CurrentDeviceIndex]; + InputDeviceCfg := @Ini.InputDeviceConfig[InputDevice.CfgIndex]; + + // update source-selection slider + SetLength(InputSourceNames, Length(InputDevice.Source)); + for SourceIndex := 0 to High(InputDevice.Source) do + begin + InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name; + end; + UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectInputSourceID, + InputSourceNames, InputDeviceCfg.Input); + + // update channel-to-player mapping sliders + for ChannelIndex := 0 to MaxChannelCount-1 do + begin + // show/hide widgets depending on whether the channel exists + if (ChannelIndex < Length(InputDeviceCfg.ChannelToPlayerMap)) then + begin + // current device has this channel + + // show slider + UpdateSelectSlideOptions(SelectSlideChannelTheme[ChannelIndex], + SelectSlideChannelID[ChannelIndex], IChannelPlayer, + InputDeviceCfg.ChannelToPlayerMap[ChannelIndex]); + SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := true; + end + else + begin + // current device does not have that many channels + + // hide slider and assign a dummy variable to it + UpdateSelectSlideOptions(SelectSlideChannelTheme[ChannelIndex], + SelectSlideChannelID[ChannelIndex], IChannelPlayer, + ChannelToPlayerMapDummy); + SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := false; + end; + end; + end; + + StartPreview(); +end; + +procedure TScreenOptionsRecord.ChangeVolume(VolumeChange: single); +var + InputDevice: TAudioInputDevice; + Volume: single; +begin + // validate CurrentDeviceIndex + if ((CurrentDeviceIndex < 0) or + (CurrentDeviceIndex > High(AudioInputProcessor.DeviceList))) then + begin + Exit; + end; + + InputDevice := AudioInputProcessor.DeviceList[CurrentDeviceIndex]; + if not assigned(InputDevice) then + Exit; + + // set new volume + Volume := InputDevice.GetVolume() + VolumeChange; + InputDevice.SetVolume(Volume); + //DebugWriteln('Volume: ' + floattostr(InputDevice.GetVolume)); + + // volume must be polled again + NextVolumePollTime := 0; +end; + +procedure TScreenOptionsRecord.onShow; +var + ChannelIndex: integer; +begin + inherited; + + Interaction := 0; + + // create preview sound-buffers + SetLength(PreviewChannel, MaxChannelCount); + for ChannelIndex := 0 to High(PreviewChannel) do + PreviewChannel[ChannelIndex] := TCaptureBuffer.Create(); + + SetLength(ChannelPeak, MaxChannelCount); + + StartPreview(); +end; + +procedure TScreenOptionsRecord.onHide; +var + ChannelIndex: integer; +begin + StopPreview(); + + // free preview buffers + for ChannelIndex := 0 to High(PreviewChannel) do + PreviewChannel[ChannelIndex].Free; + SetLength(PreviewChannel, 0); + SetLength(ChannelPeak, 0); +end; + +procedure TScreenOptionsRecord.StartPreview; +var + ChannelIndex: integer; + Device: TAudioInputDevice; +begin + if ((CurrentDeviceIndex >= 0) and + (CurrentDeviceIndex <= High(AudioInputProcessor.DeviceList))) then + begin + Device := AudioInputProcessor.DeviceList[CurrentDeviceIndex]; + // set preview channel as active capture channel + for ChannelIndex := 0 to High(Device.CaptureChannel) do + begin + PreviewChannel[ChannelIndex].Clear(); + Device.LinkCaptureBuffer(ChannelIndex, PreviewChannel[ChannelIndex]); + FillChar(ChannelPeak[ChannelIndex], SizeOf(TPeakInfo), 0); + end; + Device.Start(); + PreviewDeviceIndex := CurrentDeviceIndex; + + // volume must be polled again + NextVolumePollTime := 0; + end; +end; + +procedure TScreenOptionsRecord.StopPreview; +var + ChannelIndex: integer; + Device: TAudioInputDevice; +begin + if ((PreviewDeviceIndex >= 0) and + (PreviewDeviceIndex <= High(AudioInputProcessor.DeviceList))) then + begin + Device := AudioInputProcessor.DeviceList[PreviewDeviceIndex]; + Device.Stop; + for ChannelIndex := 0 to High(Device.CaptureChannel) do + Device.LinkCaptureBuffer(ChannelIndex, nil); + end; + PreviewDeviceIndex := -1; +end; + + +procedure TScreenOptionsRecord.DrawVolume(x, y, Width, Height: single); +var + x1, y1, x2, y2: single; + VolBarInnerWidth: integer; + Volume: single; +const + VolBarInnerHSpacing = 2; + VolBarInnerVSpacing = 1; +begin + // coordinates for black rect + x1 := x; + y1 := y; + x2 := x1 + Width; + y2 := y1 + Height; + + // init blend mode + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + // draw black background-rect + glColor4f(0, 0, 0, 0.8); + glBegin(GL_QUADS); + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + glEnd(); + + VolBarInnerWidth := Trunc(Width - 2*VolBarInnerHSpacing); + + // TODO: if no volume is available, show some info (a blue bar maybe) + if (SourceVolume >= 0) then + Volume := SourceVolume + else + Volume := 0; + + // coordinates for first half of the volume bar + x1 := x + VolBarInnerHSpacing; + x2 := x1 + VolBarInnerWidth * Volume; + y1 := y1 + VolBarInnerVSpacing; + y2 := y2 - VolBarInnerVSpacing; + + // draw volume-bar + glBegin(GL_QUADS); + // draw volume bar + glColor3f(0.4, 0.3, 0.3); + glVertex2f(x1, y1); + glVertex2f(x1, y2); + glColor3f(1, 0.1, 0.1); + glVertex2f(x2, y2); + glVertex2f(x2, y1); + glEnd(); + + { not needed anymore + // coordinates for separator + x1 := x + VolBarInnerHSpacing; + x2 := x1 + VolBarInnerWidth; + + // draw separator + glBegin(GL_LINE_STRIP); + glColor4f(0.1, 0.1, 0.1, 0.2); + glVertex2f(x1, y2); + glColor4f(0.4, 0.4, 0.4, 0.2); + glVertex2f((x1+x2)/2, y2); + glColor4f(0.1, 0.1, 0.1, 0.2); + glVertex2f(x2, y2); + glEnd(); + } + + glDisable(GL_BLEND); +end; + +procedure TScreenOptionsRecord.DrawVUMeter(const State: TDrawState; x, y, Width, Height: single); +var + x1, y1, x2, y2: single; + Volume, PeakVolume: single; + Delta: single; + VolBarInnerWidth: integer; +const + VolBarInnerHSpacing = 2; + VolBarInnerVSpacing = 1; +begin + // coordinates for black rect + x1 := x; + y1 := y; + x2 := x1 + Width; + y2 := y1 + Height; + + // init blend mode + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + // draw black background-rect + glColor4f(0, 0, 0, 0.8); + glBegin(GL_QUADS); + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + glEnd(); + + VolBarInnerWidth := Trunc(Width - 2*VolBarInnerHSpacing); + + // vertical positions + y1 := y1 + VolBarInnerVSpacing; + y2 := y2 - VolBarInnerVSpacing; + + // coordinates for bevel + x1 := x + VolBarInnerHSpacing; + x2 := x1 + VolBarInnerWidth; + + glBegin(GL_QUADS); + Volume := PreviewChannel[State.ChannelIndex].MaxSampleVolume(); + + // coordinates for volume bar + x1 := x + VolBarInnerHSpacing; + x2 := x1 + VolBarInnerWidth * Volume; + + // draw volume bar + glColor3f(State.RD, State.GD, State.BD); + glVertex2f(x1, y1); + glVertex2f(x1, y2); + glColor3f(State.R, State.G, State.B); + glVertex2f(x2, y2); + glVertex2f(x2, y1); + + Delta := (SDL_GetTicks() - ChannelPeak[State.ChannelIndex].Time)/1000; + PeakVolume := ChannelPeak[State.ChannelIndex].Volume - Delta*Delta*PeakDecay; + + // determine new peak-volume + if (Volume > PeakVolume) then + begin + PeakVolume := Volume; + ChannelPeak[State.ChannelIndex].Volume := Volume; + ChannelPeak[State.ChannelIndex].Time := SDL_GetTicks(); + end; + + x1 := x + VolBarInnerHSpacing + VolBarInnerWidth * PeakVolume; + x2 := x1 + 2; + + // draw peak + glColor3f(0.8, 0.8, 0.8); + glVertex2f(x1, y1); + glVertex2f(x1, y2); + glVertex2f(x2, y2); + glVertex2f(x2, y1); + + // draw threshold + x1 := x + VolBarInnerHSpacing; + x2 := x1 + VolBarInnerWidth * IThresholdVals[Ini.ThresholdIndex]; + + glColor4f(0.3, 0.3, 0.3, 0.6); + glVertex2f(x1, y1); + glVertex2f(x1, y2); + glVertex2f(x2, y2); + glVertex2f(x2, y1); + glEnd(); + + glDisable(GL_BLEND); +end; + +procedure TScreenOptionsRecord.DrawPitch(const State: TDrawState; x, y, Width, Height: single); +var + x1, y1, x2, y2: single; + i: integer; + ToneBoxWidth: real; + ToneString: PChar; + ToneStringWidth, ToneStringHeight: real; + ToneStringMaxWidth: real; + ToneStringCenterXOffset: real; +const + PitchBarInnerHSpacing = 2; + PitchBarInnerVSpacing = 1; +begin + // calc tone pitch + PreviewChannel[State.ChannelIndex].AnalyzeBuffer(); + + // coordinates for black rect + x1 := x; + y1 := y; + x2 := x + Width; + y2 := y + Height; + + // init blend mode + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + // draw black background-rect + glColor4f(0, 0, 0, 0.8); + glBegin(GL_QUADS); + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + glEnd(); + + // coordinates for tone boxes + ToneBoxWidth := Width / NumHalftones; + y1 := y1 + PitchBarInnerVSpacing; + y2 := y2 - PitchBarInnerVSpacing; + + glBegin(GL_QUADS); + // draw tone boxes + for i := 0 to NumHalftones-1 do + begin + x1 := x + i * ToneBoxWidth + PitchBarInnerHSpacing; + x2 := x1 + ToneBoxWidth - 2*PitchBarInnerHSpacing; + + if ((PreviewChannel[State.ChannelIndex].ToneValid) and + (PreviewChannel[State.ChannelIndex].ToneAbs = i)) then + begin + // highlight current tone-pitch + glColor3f(1, i / (NumHalftones-1), 0) + end + else + begin + // grey other tone-pitches + glColor3f(0.3, i / (NumHalftones-1) * 0.3, 0); + end; + + glVertex2f(x1, y1); + glVertex2f(x2, y1); + glVertex2f(x2, y2); + glVertex2f(x1, y2); + end; + glEnd(); + + glDisable(GL_BLEND); + + /// + // draw the name of the tone + /////// + + ToneString := PChar(PreviewChannel[State.ChannelIndex].ToneString); + ToneStringHeight := ChannelBarsTotalHeight; + + // initialize font + // TODO: what about reflection, italic etc.? + SetFontSize(ToneStringHeight/3); + + // center + // Note: for centering let us assume that G#4 has the max. horizontal extent + ToneStringWidth := glTextWidth(ToneString); + ToneStringMaxWidth := glTextWidth('G#4'); + ToneStringCenterXOffset := (ToneStringMaxWidth-ToneStringWidth) / 2; + + // draw + SetFontPos(x-ToneStringWidth-ToneStringCenterXOffset, y-ToneStringHeight/2); + glColor3f(0, 0, 0); + glPrint(ToneString); +end; + +function TScreenOptionsRecord.Draw: boolean; +var + i: integer; + Device: TAudioInputDevice; + DeviceCfg: PInputDeviceConfig; + SelectSlide: TSelectSlide; + BarXOffset, BarYOffset, BarWidth: real; + ChannelIndex: integer; + State: TDrawState; +begin + DrawBG; + DrawFG; + + if ((PreviewDeviceIndex >= 0) and + (PreviewDeviceIndex <= High(AudioInputProcessor.DeviceList))) then + begin + Device := AudioInputProcessor.DeviceList[PreviewDeviceIndex]; + DeviceCfg := @Ini.InputDeviceConfig[Device.CfgIndex]; + + // update source volume + if (SDL_GetTicks() >= NextVolumePollTime) then + begin + NextVolumePollTime := SDL_GetTicks() + 500; // next poll in 500ms + SourceVolume := Device.GetVolume(); + end; + + // get source select slide + SelectSlide := SelectsS[SelectInputSourceID]; + BarXOffset := SelectSlide.TextureSBG.X; + BarYOffset := SelectSlide.TextureSBG.Y + SelectSlide.TextureSBG.H + BarUpperSpacing; + BarWidth := SelectSlide.TextureSBG.W; + DrawVolume(SelectSlide.TextureSBG.X, BarYOffset, BarWidth, BarHeight); + + for ChannelIndex := 0 to High(Device.CaptureChannel) do + begin + // load player color mapped to current input channel + if (DeviceCfg.ChannelToPlayerMap[ChannelIndex] > 0) then + begin + // set mapped channel to corresponding player-color + LoadColor(State.R, State.G, State.B, 'P'+ IntToStr(DeviceCfg.ChannelToPlayerMap[ChannelIndex]) + 'Dark'); + end + else + begin + // set non-mapped channel to white + State.R := 1; State.G := 1; State.B := 1; + end; + + // dark player colors + State.RD := 0.2 * State.R; + State.GD := 0.2 * State.G; + State.BD := 0.2 * State.B; + + // channel select slide + SelectSlide := SelectsS[SelectSlideChannelID[ChannelIndex]]; + + BarXOffset := SelectSlide.TextureSBG.X; + BarYOffset := SelectSlide.TextureSBG.Y + SelectSlide.TextureSBG.H + BarUpperSpacing; + BarWidth := SelectSlide.TextureSBG.W; + + State.ChannelIndex := ChannelIndex; + + DrawVUMeter(State, BarXOffset, BarYOffset, BarWidth, BarHeight); + DrawPitch(State, BarXOffset, BarYOffset+BarHeight, BarWidth, BarHeight); + end; + end; + + Result := True; +end; + + +end. diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas new file mode 100644 index 00000000..9c602788 --- /dev/null +++ b/src/screens/UScreenOptionsSound.pas @@ -0,0 +1,133 @@ +unit UScreenOptionsSound; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + +type + TScreenOptionsSound = class(TMenu) + public + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, SysUtils; + +function TScreenOptionsSound.ParseInput(PressedKey: cardinal; + CharCode: widechar; PressedDown: boolean): boolean; +begin + Result := True; + if (PressedDown) then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := False; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + // Escape -> save nothing - just leave this screen + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 8 then + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP: + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction < 8) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction < 8) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; + +{** + * Actually this one isn't pretty - but it does the trick of + * turning the background music on/off in "real time" + * bgm = background music + * TODO: - Fetching the SelectInteraction via something more descriptive + * - Obtaining the current value of a select is imho ugly + *} + if (SelInteraction = 1) then + begin + if TBackgroundMusicOption(SelectsS[1].SelectedOption) = bmoOn then + SoundLib.StartBgMusic + else + SoundLib.PauseBgMusic; + end; + +end; + +constructor TScreenOptionsSound.Create; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsSound); + + AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, + Ini.VoicePassthrough, IVoicePassthrough); + AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, + Ini.BackgroundMusicOption, IBackgroundMusic); + AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + // TODO: - MicBoost needs to be moved to ScreenOptionsRecord + AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); + AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.ThresholdIndex, IThreshold); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, + Ini.PreviewVolume, IPreviewVolume); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, + Ini.PreviewFading, IPreviewFading); + + AddButton(Theme.OptionsSound.ButtonExit); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; +end; + +procedure TScreenOptionsSound.onShow; +begin + inherited; + Interaction := 0; +end; + +end. diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas new file mode 100644 index 00000000..a4f00b64 --- /dev/null +++ b/src/screens/UScreenOptionsThemes.pas @@ -0,0 +1,171 @@ +unit UScreenOptionsThemes; + +interface + +{$I switches.inc} + +uses + SDL, + UMenu, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; + +type + TScreenOptionsThemes = class(TMenu) + private + procedure ReloadTheme; + public + SkinSelect: Integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure InteractInc; override; + procedure InteractDec; override; + end; + +implementation + +uses UMain, + UGraphic, + USkins, + SysUtils; + +function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + // Escape -> save nothing - just leave this screen + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + SDLK_RETURN: + begin + if SelInteraction = 3 then + begin + Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); + + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; + end; + SDLK_DOWN: + InteractNext; + SDLK_UP : + InteractPrev; + SDLK_RIGHT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + end; + end; + SDLK_LEFT: + begin + if (SelInteraction >= 0) and (SelInteraction <= 2) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + end; + end; + end; + end; +end; + +procedure TScreenOptionsThemes.InteractInc; +begin + inherited InteractInc; + + //Update Skins + if (SelInteraction = 0) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +procedure TScreenOptionsThemes.InteractDec; +begin + inherited InteractDec; + + //Update Skins + if (SelInteraction = 0 ) then + begin + Skin.OnThemeChange; + UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + end; + + ReloadTheme(); +end; + +constructor TScreenOptionsThemes.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.OptionsThemes); + + AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + + SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + + AddButton(Theme.OptionsThemes.ButtonExit); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); +end; + +procedure TScreenOptionsThemes.onShow; +begin + inherited; + + Interaction := 0; +end; + +procedure TScreenOptionsThemes.ReloadTheme; +begin + Theme.LoadTheme(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); + + ScreenOptionsThemes := TScreenOptionsThemes.create(); + ScreenOptionsThemes.onshow; + Display.CurrentScreen := @ScreenOptionsThemes; + + ScreenOptionsThemes.Interaction := self.Interaction; + ScreenOptionsThemes.Draw; + + + Display.Draw; + SwapBuffers; + + freeandnil( self ); +end; + +end. diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas new file mode 100644 index 00000000..057344dc --- /dev/null +++ b/src/screens/UScreenPartyNewRound.pas @@ -0,0 +1,439 @@ +unit UScreenPartyNewRound; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPartyNewRound = class(TMenu) + public + //Texts: + TextRound1: Cardinal; + TextRound2: Cardinal; + TextRound3: Cardinal; + TextRound4: Cardinal; + TextRound5: Cardinal; + TextRound6: Cardinal; + TextRound7: Cardinal; + + TextWinner1: Cardinal; + TextWinner2: Cardinal; + TextWinner3: Cardinal; + TextWinner4: Cardinal; + TextWinner5: Cardinal; + TextWinner6: Cardinal; + TextWinner7: Cardinal; + + TextNextRound: Cardinal; + TextNextRoundNo: Cardinal; + TextNextPlayer1: Cardinal; + TextNextPlayer2: Cardinal; + TextNextPlayer3: Cardinal; + + //Statics + StaticRound1: Cardinal; + StaticRound2: Cardinal; + StaticRound3: Cardinal; + StaticRound4: Cardinal; + StaticRound5: Cardinal; + StaticRound6: Cardinal; + StaticRound7: Cardinal; + + //Scores + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + + TextTeam1Players: Cardinal; + TextTeam2Players: Cardinal; + TextTeam3Players: Cardinal; + + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + StaticNextPlayer1: Cardinal; + StaticNextPlayer2: Cardinal; + StaticNextPlayer3: Cardinal; + + + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog; + +function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + + SDLK_RETURN: + begin + AudioPlayback.PlaySound(SoundLib.Start); + if DLLMan.Selected.LoadSong then + begin + //Select PartyMode ScreenSong + ScreenSong.Mode := smPartyMode; + FadeTo(@ScreenSong); + end + else + begin + FadeTo(@ScreenSingModi); + end; + end; + end; + end; +end; + +constructor TScreenPartyNewRound.Create; +var + I: integer; +begin + inherited Create; + + TextRound1 := AddText (Theme.PartyNewRound.TextRound1); + TextRound2 := AddText (Theme.PartyNewRound.TextRound2); + TextRound3 := AddText (Theme.PartyNewRound.TextRound3); + TextRound4 := AddText (Theme.PartyNewRound.TextRound4); + TextRound5 := AddText (Theme.PartyNewRound.TextRound5); + TextRound6 := AddText (Theme.PartyNewRound.TextRound6); + TextRound7 := AddText (Theme.PartyNewRound.TextRound7); + + TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1); + TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2); + TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3); + TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4); + TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5); + TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6); + TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7); + + TextNextRound := AddText (Theme.PartyNewRound.TextNextRound); + TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo); + TextNextPlayer1 := AddText (Theme.PartyNewRound.TextNextPlayer1); + TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2); + TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3); + + StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1); + StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2); + StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3); + StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4); + StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5); + StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6); + StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7); + + //Scores + TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyNewRound.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyNewRound.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyNewRound.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyNewRound.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyNewRound.TextNameTeam3); + + //Players + TextTeam1Players := AddText (Theme.PartyNewRound.TextTeam1Players); + TextTeam2Players := AddText (Theme.PartyNewRound.TextTeam2Players); + TextTeam3Players := AddText (Theme.PartyNewRound.TextTeam3Players); + + StaticTeam1 := AddStatic (Theme.PartyNewRound.StaticTeam1); + StaticTeam2 := AddStatic (Theme.PartyNewRound.StaticTeam2); + StaticTeam3 := AddStatic (Theme.PartyNewRound.StaticTeam3); + StaticNextPlayer1 := AddStatic (Theme.PartyNewRound.StaticNextPlayer1); + StaticNextPlayer2 := AddStatic (Theme.PartyNewRound.StaticNextPlayer2); + StaticNextPlayer3 := AddStatic (Theme.PartyNewRound.StaticNextPlayer3); + + LoadFromTheme(Theme.PartyNewRound); +end; + +procedure TScreenPartyNewRound.onShow; +var + I: Integer; + function GetTeamPlayers(const Num: Byte): String; + var + Players: Array of String; + J: Byte; + begin // to-do : Party + if (Num-1 >= {PartySession.Teams.NumTeams}0) then + exit; + + {//Create Players Array + SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); + For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);} + + //Implode and Return + Result := Language.Implode(Players); + end; +begin + inherited; + + // to-do : Party + //PartySession.StartRound; + + //Set Visibility of Round Infos + // to-do : Party + I := {Length(PartySession.Rounds)}0; + if (I >= 1) then + begin + Static[StaticRound1].Visible := True; + Text[TextRound1].Visible := True; + Text[TextWinner1].Visible := True; + + //Texts: + //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + //Text[TextWinner1].Text := PartySession.GetWinnerString(0); + end + else + begin + Static[StaticRound1].Visible := False; + Text[TextRound1].Visible := False; + Text[TextWinner1].Visible := False; + end; + + if (I >= 2) then + begin + Static[StaticRound2].Visible := True; + Text[TextRound2].Visible := True; + Text[TextWinner2].Visible := True; + + //Texts: + //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + //Text[TextWinner2].Text := PartySession.GetWinnerString(1); + end + else + begin + Static[StaticRound2].Visible := False; + Text[TextRound2].Visible := False; + Text[TextWinner2].Visible := False; + end; + + if (I >= 3) then + begin + Static[StaticRound3].Visible := True; + Text[TextRound3].Visible := True; + Text[TextWinner3].Visible := True; + + //Texts: + //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + //Text[TextWinner3].Text := PartySession.GetWinnerString(2); + end + else + begin + Static[StaticRound3].Visible := False; + Text[TextRound3].Visible := False; + Text[TextWinner3].Visible := False; + end; + + if (I >= 4) then + begin + Static[StaticRound4].Visible := True; + Text[TextRound4].Visible := True; + Text[TextWinner4].Visible := True; + + //Texts: + //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + //Text[TextWinner4].Text := PartySession.GetWinnerString(3); + end + else + begin + Static[StaticRound4].Visible := False; + Text[TextRound4].Visible := False; + Text[TextWinner4].Visible := False; + end; + + if (I >= 5) then + begin + Static[StaticRound5].Visible := True; + Text[TextRound5].Visible := True; + Text[TextWinner5].Visible := True; + + //Texts: + //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + //Text[TextWinner5].Text := PartySession.GetWinnerString(4); + end + else + begin + Static[StaticRound5].Visible := False; + Text[TextRound5].Visible := False; + Text[TextWinner5].Visible := False; + end; + + if (I >= 6) then + begin + Static[StaticRound6].Visible := True; + Text[TextRound6].Visible := True; + Text[TextWinner6].Visible := True; + + //Texts: + //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + //Text[TextWinner6].Text := PartySession.GetWinnerString(5); + end + else + begin + Static[StaticRound6].Visible := False; + Text[TextRound6].Visible := False; + Text[TextWinner6].Visible := False; + end; + + if (I >= 7) then + begin + Static[StaticRound7].Visible := True; + Text[TextRound7].Visible := True; + Text[TextWinner7].Visible := True; + + //Texts: + //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + //Text[TextWinner7].Text := PartySession.GetWinnerString(6); + end + else + begin + Static[StaticRound7].Visible := False; + Text[TextRound7].Visible := False; + Text[TextWinner7].Visible := False; + end; + + //Display Scores + {if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + Text[TextTeam1Players].Text := GetTeamPlayers(1); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Text[TextTeam1Players].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticNextPlayer1].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Text[TextTeam1Players].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticNextPlayer1].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + Text[TextTeam2Players].Text := GetTeamPlayers(2); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Text[TextTeam2Players].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticNextPlayer2].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Text[TextTeam2Players].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticNextPlayer2].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + Text[TextTeam3Players].Text := GetTeamPlayers(3); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Text[TextTeam3Players].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticNextPlayer3].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Text[TextTeam3Players].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticNextPlayer3].Visible := False; + end; + + //nextRound Texts + Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc); + Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1); + if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; + Text[TextNextPlayer1].Visible := True; + end + else + Text[TextNextPlayer1].Visible := False; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; + Text[TextNextPlayer2].Visible := True; + end + else + Text[TextNextPlayer2].Visible := False; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; + Text[TextNextPlayer3].Visible := True; + end + else + Text[TextNextPlayer3].Visible := False; } + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); +begin + {Button[0].Texture.ScaleW := Progress; + Button[1].Texture.ScaleW := Progress; + Button[2].Texture.ScaleW := Progress; } +end; + +end. diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas new file mode 100644 index 00000000..bd05e653 --- /dev/null +++ b/src/screens/UScreenPartyOptions.pas @@ -0,0 +1,279 @@ +unit UScreenPartyOptions; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPartyOptions = class(TMenu) + public + SelectLevel: Cardinal; + SelectPlayList: Cardinal; + SelectPlayList2: Cardinal; + SelectRounds: Cardinal; + SelectTeams: Cardinal; + SelectPlayers1: Cardinal; + SelectPlayers2: Cardinal; + SelectPlayers3: Cardinal; + + PlayList: Integer; + PlayList2: Integer; + Rounds: Integer; + NumTeams: Integer; + NumPlayer1, NumPlayer2, NumPlayer3: Integer; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + procedure SetPlaylist2; + end; + +var + IPlaylist: array[0..2] of String; + IPlaylist2: array of String; +const + ITeams: array[0..1] of String =('2', '3'); + IPlayers: array[0..3] of String =('1', '2', '3', '4'); + IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7'); + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; + +function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; + var + I, J: Integer; + OnlyMultiPlayer: boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + //Don'T start when Playlist is Selected and there are no Playlists + If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then + Exit; + // Don't start when SinglePlayer Teams but only Multiplayer Plugins available + OnlyMultiPlayer:=true; + for I := 0 to High(DLLMan.Plugins) do begin + OnlyMultiPlayer := (OnlyMultiPlayer AND DLLMan.Plugins[I].TeamModeOnly); + end; + if (OnlyMultiPlayer) AND ((NumPlayer1 = 0) OR (NumPlayer2 = 0) OR ((NumPlayer3 = 0) AND (NumTeams = 1))) then begin + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + Exit; + end; + //Save Difficulty + Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; + Ini.SaveLevel; + + + //Save Num Teams: + {PartySession.Teams.NumTeams := NumTeams + 2; + PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; + PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} + + //Save Playlist + PlaylistMan.Mode := TSingMode( Playlist ); + PlaylistMan.CurPlayList := High(Cardinal); + //If Category Selected Search Category ID + if Playlist = 1 then + begin + J := -1; + For I := 0 to high(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Inc(J); + + if J = Playlist2 then + begin + PlaylistMan.CurPlayList := I; + Break; + end; + end; + + //No Categorys or Invalid Entry + If PlaylistMan.CurPlayList = High(Cardinal) then + Exit; + end + else + PlaylistMan.CurPlayList := Playlist2; + + //Start Party + // to-do : Party + //PartySession.StartNewParty(Rounds + 2); + + AudioPlayback.PlaySound(SoundLib.Start); + //Go to Player Screen + FadeTo(@ScreenPartyPlayer); + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + SelectsS[7].Visible := (NumTeams = 1); + end; + end; + SDLK_LEFT: + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + + //Change Playlist2 if Playlist is Changed + If (Interaction = 1) then + begin + SetPlaylist2; + end //Change Team3 Players visibility + Else If (Interaction = 4) then + begin + SelectsS[7].Visible := (NumTeams = 1); + end; + end; + end; + end; +end; + +constructor TScreenPartyOptions.Create; +var + I: integer; +begin + inherited Create; + //Fill IPlaylist + IPlaylist[0] := Language.Translate('PARTY_PLAYLIST_ALL'); + IPlaylist[1] := Language.Translate('PARTY_PLAYLIST_CATEGORY'); + IPlaylist[2] := Language.Translate('PARTY_PLAYLIST_PLAYLIST'); + + //Fill IPlaylist2 + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + + //Clear all Selects + NumTeams := 0; + NumPlayer1 := 0; + NumPlayer2 := 0; + NumPlayer3 := 0; + Rounds := 5; + PlayList := 0; + PlayList2 := 0; + + //Load Screen From Theme + LoadFromTheme(Theme.PartyOptions); + + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); + SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); + SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); + SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); + SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); + SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); + + Interaction := 0; + + //Hide Team3 Players + SelectsS[7].Visible := False; +end; + +procedure TScreenPartyOptions.SetPlaylist2; +var I: Integer; +begin + Case Playlist of + 0: + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := '---'; + end; + 1: + begin + SetLength(IPlaylist2, 0); + For I := 0 to high(CatSongs.Song) do + begin + If (CatSongs.Song[I].Main) then + begin + SetLength(IPlaylist2, Length(IPlaylist2) + 1); + IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; + end; + end; + + If (Length(IPlaylist2) = 0) then + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Categories found'; + end; + end; + 2: + begin + if (Length(PlaylistMan.Playlists) > 0) then + begin + SetLength(IPlaylist2, Length(PlaylistMan.Playlists)); + PlaylistMan.GetNames(IPlaylist2); + end + else + begin + SetLength(IPlaylist2, 1); + IPlaylist2[0] := 'No Playlists found'; + end; + end; + end; + + Playlist2 := 0; + UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); +end; + +procedure TScreenPartyOptions.onShow; +begin + inherited; + + Randomize; + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); +begin + {for I := 0 to 6 do + SelectS[I].Texture.ScaleW := Progress;} +end; + +end. diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas new file mode 100644 index 00000000..fa717677 --- /dev/null +++ b/src/screens/UScreenPartyPlayer.pas @@ -0,0 +1,340 @@ +unit UScreenPartyPlayer; + +Interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPartyPlayer = class(TMenu) + public + Team1Name: Cardinal; + Player1Name: Cardinal; + Player2Name: Cardinal; + Player3Name: Cardinal; + Player4Name: Cardinal; + + Team2Name: Cardinal; + Player5Name: Cardinal; + Player6Name: Cardinal; + Player7Name: Cardinal; + Player8Name: Cardinal; + + Team3Name: Cardinal; + Player9Name: Cardinal; + Player10Name: Cardinal; + Player11Name: Cardinal; + Player12Name: Cardinal; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UIni, UTexture, UParty; + +function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +var +{*I, *}J: integer; // Auto Removed, Unused Variable (I) + SDL_ModState: Word; + procedure IntNext; + begin + repeat + InteractNext; + until Button[Interaction].Visible; + end; + procedure IntPrev; + begin + repeat + InteractPrev; + until Button[Interaction].Visible; + end; +begin + Result := true; + + if (PressedDown) then + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT) + else + SDL_ModState := 0; + + begin // Key Down + // check normal keys + case CharCode of + '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"': + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; + Exit; + end; + end; + + // check special keys + case PressedKey of + // Templates for Names Mod + SDLK_F1: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + end; + SDLK_F2: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + end; + SDLK_F3: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + end; + SDLK_F4: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + end; + SDLK_F5: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + end; + SDLK_F6: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + end; + SDLK_F7: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + end; + SDLK_F8: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + end; + SDLK_F9: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + end; + SDLK_F10: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + end; + SDLK_F11: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + end; + SDLK_F12: + if (SDL_ModState = KMOD_LALT) then + begin + Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + end + else + begin + Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + end; + + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + end; + + SDLK_ESCAPE: + begin + Ini.SaveNames; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenPartyOptions); + end; + + SDLK_RETURN: + begin + + {//Save PlayerNames + for I := 0 to PartySession.Teams.NumTeams-1 do + begin + PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); + for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do + begin + PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); + PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; + end; + end; + + AudioPlayback.PlayStart; + FadeTo(@ScreenPartyNewRound);} + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: IntNext; + SDLK_UP: IntPrev; + SDLK_RIGHT: IntNext; + SDLK_LEFT: IntPrev; + end; + end; +end; + +constructor TScreenPartyPlayer.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + LoadFromTheme(Theme.PartyPlayer); + + Team1Name := AddButton(Theme.PartyPlayer.Team1Name); + AddButton(Theme.PartyPlayer.Player1Name); + AddButton(Theme.PartyPlayer.Player2Name); + AddButton(Theme.PartyPlayer.Player3Name); + AddButton(Theme.PartyPlayer.Player4Name); + + Team2Name := AddButton(Theme.PartyPlayer.Team2Name); + AddButton(Theme.PartyPlayer.Player5Name); + AddButton(Theme.PartyPlayer.Player6Name); + AddButton(Theme.PartyPlayer.Player7Name); + AddButton(Theme.PartyPlayer.Player8Name); + + Team3Name := AddButton(Theme.PartyPlayer.Team3Name); + AddButton(Theme.PartyPlayer.Player9Name); + AddButton(Theme.PartyPlayer.Player10Name); + AddButton(Theme.PartyPlayer.Player11Name); + AddButton(Theme.PartyPlayer.Player12Name); + + Interaction := 0; +end; + +procedure TScreenPartyPlayer.onShow; +var + I: integer; +begin + inherited; + + // Templates for Names Mod + for I := 1 to 4 do + Button[I].Text[0].Text := Ini.Name[I-1]; + + for I := 6 to 9 do + Button[I].Text[0].Text := Ini.Name[I-2]; + + for I := 11 to 14 do + Button[I].Text[0].Text := Ini.Name[I-3]; + + Button[0].Text[0].Text := Ini.NameTeam[0]; + Button[5].Text[0].Text := Ini.NameTeam[1]; + Button[10].Text[0].Text := Ini.NameTeam[2]; + // Templates for Names Mod end + + {If (PartySession.Teams.NumTeams>=1) then + begin + Button[0].Visible := True; + Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); + Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); + Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); + Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4); + end + else + begin + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := False; + Button[4].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=2) then + begin + Button[5].Visible := True; + Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); + Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); + Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); + Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4); + end + else + begin + Button[5].Visible := False; + Button[6].Visible := False; + Button[7].Visible := False; + Button[8].Visible := False; + Button[9].Visible := False; + end; + + If (PartySession.Teams.NumTeams>=3) then + begin + Button[10].Visible := True; + Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); + Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); + Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); + Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4); + end + else + begin + Button[10].Visible := False; + Button[11].Visible := False; + Button[12].Visible := False; + Button[13].Visible := False; + Button[14].Visible := False; + end; } + +end; + +procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real); +var + I: integer; +begin + for I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas new file mode 100644 index 00000000..176a94b2 --- /dev/null +++ b/src/screens/UScreenPartyScore.pas @@ -0,0 +1,302 @@ +unit UScreenPartyScore; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyScore = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; + StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; + StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; + TextWinner: Cardinal; + + DecoTex: Array[0..5] of Integer; + DecoColor: Array[0..5] of Record + R, G, B: Real; + end; + + MaxScore: Word; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UTexture, USkins; + +function TScreenPartyScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Start); + {if (PartySession.CurRound < High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else // to-do : Party + begin + PartySession.EndRound; } + FadeTo(@ScreenPartyWin); + //end; + end; + + SDLK_RETURN: + begin + AudioPlayback.PlaySound(SoundLib.Start); + // to-do : Party + {if (PartySession.CurRound < High(PartySession.Rounds)) then + FadeTo(@ScreenPartyNewRound) + else } + FadeTo(@ScreenPartyWin); + end; + end; + end; +end; + +constructor TScreenPartyScore.Create; +var +// I: integer; // Auto Removed, Unused Variable + Tex: TTexture; + R, G, B: Real; + Color: Integer; +begin + inherited Create; + + TextScoreTeam1 := AddText (Theme.PartyScore.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyScore.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyScore.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyScore.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyScore.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyScore.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyScore.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyScore.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyScore.StaticTeam1Deco); + StaticTeam2 := AddStatic (Theme.PartyScore.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyScore.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyScore.StaticTeam2Deco); + StaticTeam3 := AddStatic (Theme.PartyScore.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyScore.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyScore.StaticTeam3Deco); + + TextWinner := AddText (Theme.PartyScore.TextWinner); + + //Load Deco Textures + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + //Get Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.FirstColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[0].R := R; + DecoColor[0].G := G; + DecoColor[0].B := B; + + //Load Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), Theme.PartyScore.DecoTextures.FirstTyp, Color); + DecoTex[0] := Tex.TexNum; + + //Get Second Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.SecondColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[1].R := R; + DecoColor[1].G := G; + DecoColor[1].B := B; + + //Load Second Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), Theme.PartyScore.DecoTextures.SecondTyp, Color); + DecoTex[1] := Tex.TexNum; + + //Get Third Color + LoadColor(R, G, B, Theme.PartyScore.DecoTextures.ThirdColor); + Color := $10000 * Round(R*255) + $100 * Round(G*255) + Round(B*255); + DecoColor[2].R := R; + DecoColor[2].G := G; + DecoColor[2].B := B; + + //Load Third Texture + Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), Theme.PartyScore.DecoTextures.ThirdTyp, Color); + DecoTex[2] := Tex.TexNum; + end; + + LoadFromTheme(Theme.PartyScore); +end; + +procedure TScreenPartyScore.onShow; +var + I, J: Integer; + Placings: Array [0..5] of Byte; +begin + inherited; + + + //Get Maxscore + + MaxScore := 0; + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + if (ScreenSingModi.PlayerInfo.Playerinfo[I].Score > MaxScore) then + MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; + end; + + //Get Placings + for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + begin + Placings[I] := 0; + for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do + If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then + Inc(Placings[I]); + end; + + + //Set Static Length + Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + + //fix: prevents static from drawn out of bounds. + if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99; + if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; + if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; + + //End Last Round // to-do : Party + //PartySession.EndRound; + + //Set Winnertext + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); + Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Placings[0]]; + Static[StaticTeam1Deco].Texture.ColR := DecoColor[Placings[0]].R; + Static[StaticTeam1Deco].Texture.ColG := DecoColor[Placings[0]].G; + Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; + end; + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); + Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Placings[1]]; + Static[StaticTeam2Deco].Texture.ColR := DecoColor[Placings[1]].R; + Static[StaticTeam2Deco].Texture.ColG := DecoColor[Placings[1]].G; + Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; + end; + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; + end; + + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); + Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + + //Set Deco Texture + if Theme.PartyScore.DecoTextures.ChangeTextures then + begin + Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Placings[2]]; + Static[StaticTeam3Deco].Texture.ColR := DecoColor[Placings[2]].R; + Static[StaticTeam3Deco].Texture.ColG := DecoColor[Placings[2]].G; + Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; + end; + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; + end; + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyScore.SetAnimationProgress(Progress: real); +begin + if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; +end; + +end. diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas new file mode 100644 index 00000000..002c6f75 --- /dev/null +++ b/src/screens/UScreenPartyWin.pas @@ -0,0 +1,267 @@ +unit UScreenPartyWin; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + +type + TScreenPartyWin = class(TMenu) + public + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; + StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; + StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; + TextWinner: Cardinal; + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +implementation + +uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; + +function TScreenPartyWin.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenMain); + end; + + SDLK_RETURN: + begin + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenMain); + end; + end; + end; +end; + +constructor TScreenPartyWin.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + TextScoreTeam1 := AddText (Theme.PartyWin.TextScoreTeam1); + TextScoreTeam2 := AddText (Theme.PartyWin.TextScoreTeam2); + TextScoreTeam3 := AddText (Theme.PartyWin.TextScoreTeam3); + TextNameTeam1 := AddText (Theme.PartyWin.TextNameTeam1); + TextNameTeam2 := AddText (Theme.PartyWin.TextNameTeam2); + TextNameTeam3 := AddText (Theme.PartyWin.TextNameTeam3); + + StaticTeam1 := AddStatic (Theme.PartyWin.StaticTeam1); + StaticTeam1BG := AddStatic (Theme.PartyWin.StaticTeam1BG); + StaticTeam1Deco := AddStatic (Theme.PartyWin.StaticTeam1Deco); + StaticTeam2 := AddStatic (Theme.PartyWin.StaticTeam2); + StaticTeam2BG := AddStatic (Theme.PartyWin.StaticTeam2BG); + StaticTeam2Deco := AddStatic (Theme.PartyWin.StaticTeam2Deco); + StaticTeam3 := AddStatic (Theme.PartyWin.StaticTeam3); + StaticTeam3BG := AddStatic (Theme.PartyWin.StaticTeam3BG); + StaticTeam3Deco := AddStatic (Theme.PartyWin.StaticTeam3Deco); + + TextWinner := AddText (Theme.PartyWin.TextWinner); + + LoadFromTheme(Theme.PartyWin); +end; + +procedure TScreenPartyWin.onShow; +//var +// I: Integer; // Auto Removed, Unused Variable +// Placing: Integer; // Auto Removed, Unused Variable + + Function GetTeamColor(Team: Byte): Cardinal; + var + NameString: String; + begin + NameString := 'P' + InttoStr(Team+1) + 'Dark'; + + Result := ColorExists(NameString); + end; + +begin + inherited; + + // to-do : Party + //Get Team Placing + //Placing := PartySession.GetTeamOrder; + + //Set Winnertext + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + {if (PartySession.Teams.NumTeams >= 1) then + begin + Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); + + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[0]); + if (I <> -1) then + begin + Static[StaticTeam1].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam1].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam1].Texture.ColB := Color[I].RGB.B; + end; + end; + end + else + begin + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name); + + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[1]); + if (I <> -1) then + begin + Static[StaticTeam2].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam2].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam2].Texture.ColB := Color[I].RGB.B; + end; + end; + end + else + begin + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name); + + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; + + //Set Static Color to Team Color + If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3BG].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3BG].Texture.ColB := Color[I].RGB.B; + end; + end; + + If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then + begin + I := GetTeamColor(Placing[2]); + if (I <> -1) then + begin + Static[StaticTeam3].Texture.ColR := Color[I].RGB.R; + Static[StaticTeam3].Texture.ColG := Color[I].RGB.G; + Static[StaticTeam3].Texture.ColB := Color[I].RGB.B; + end; + end; + end + else + begin + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; + end; } + + +// LCD.WriteText(1, ' Choose mode: '); +// UpdateLCD; +end; + +procedure TScreenPartyWin.SetAnimationProgress(Progress: real); +begin + {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Score / maxScore; + if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Score / maxScore;} +end; + +end. diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas new file mode 100644 index 00000000..b51fac98 --- /dev/null +++ b/src/screens/UScreenPopup.pas @@ -0,0 +1,252 @@ +unit UScreenPopup; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenPopupCheck = class(TMenu) + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure ShowPopup(msg: String); + function Draw: boolean; override; + end; + +type + TScreenPopupError = class(TMenu) +{ private + CurMenu: Byte; //Num of the cur. Shown Menu} + public + Visible: Boolean; //Whether the Menu should be Drawn + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onHide; override; + procedure ShowPopup(msg: String); + function Draw: boolean; override; + end; + +var +// ISelections: Array of String; + SelectValue: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; + +function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + Visible:=False; + Result := false; + end; + + SDLK_RETURN: + begin + case Interaction of + 0: begin + //Hack to Finish Singscreen correct on Exit with Q Shortcut + if (Display.NextScreenWithCheck = NIL) then + begin + if (Display.CurrentScreen = @ScreenSing) then + ScreenSing.Finish + else if (Display.CurrentScreen = @ScreenSingModi) then + ScreenSingModi.Finish; + end; + + Display.CheckOK:=True; + end; + 1: begin + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + end; + end; + Visible:=False; + Result := false; + end; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenPopupCheck.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.CheckPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddButton(Theme.CheckPopup.Button2); + if (Length(Button[1].Text) = 0) then + AddButtonText(14, 20, 'Button 2'); + + AddText(Theme.CheckPopup.TextCheck); + + for I := 0 to High(Theme.CheckPopup.Static) do + AddStatic(Theme.CheckPopup.Static[I]); + + for I := 0 to High(Theme.CheckPopup.Text) do + AddText(Theme.CheckPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopupCheck.Draw: boolean; +begin + Draw:=inherited Draw; +end; + +procedure TScreenPopupCheck.onShow; +begin + inherited; +end; + +procedure TScreenPopupCheck.ShowPopup(msg: String); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + + Text[0].Text := Language.Translate(msg); + + Button[0].Visible := True; + Button[1].Visible := True; + + Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); + Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); +end; + +// error popup + +function TScreenPopupError.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + + case PressedKey of + SDLK_Q: + begin + Result := false; + end; + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Visible:=False; + Result := false; + end; + + SDLK_RETURN: + begin + Visible:=False; + Result := false; + end; + + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; + end; + end; +end; + +constructor TScreenPopupError.Create; +var + I: integer; +begin + inherited Create; + + AddBackground(Theme.CheckPopup.Background.Tex); + + AddButton(Theme.ErrorPopup.Button1); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, 'Button 1'); + + AddText(Theme.ErrorPopup.TextError); + + for I := 0 to High(Theme.ErrorPopup.Static) do + AddStatic(Theme.ErrorPopup.Static[I]); + + for I := 0 to High(Theme.ErrorPopup.Text) do + AddText(Theme.ErrorPopup.Text[I]); + + Interaction := 0; +end; + +function TScreenPopupError.Draw: boolean; +begin + Draw:=inherited Draw; +end; + +procedure TScreenPopupError.onShow; +begin + inherited; + +end; + +procedure TScreenPopupError.onHide; +begin +end; + +procedure TScreenPopupError.ShowPopup(msg: String); +begin + Interaction := 0; //Reset Interaction + Visible := True; //Set Visible + +{ //dirty hack... Text[0] is invisible for some strange reason + for i:=1 to high(Text) do + if i-1 <= high(msg) then + begin + Text[i].Visible:=True; + Text[i].Text := msg[i-1]; + end + else + begin + Text[i].Visible:=False; + end;} + Text[0].Text:=msg; + + Button[0].Visible := True; + + Button[0].Text[0].Text := 'OK'; +end; + +end. diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas new file mode 100644 index 00000000..ab6c020d --- /dev/null +++ b/src/screens/UScreenScore.pas @@ -0,0 +1,848 @@ +unit UScreenScore; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + USongs, + UThemes, + gl, + math, + UTexture; + +const + ZBars : real = 0.8; // Z value for the bars + ZRatingPic : real = 0.8; // Z value for the rating pictures + + EaseOut_MaxSteps : real = 10; // that's the speed of the bars (10 is fast | 100 is slower) + + BarRaiseSpeed : cardinal = 0; // Time for raising the bar one step higher (in ms) + +type + TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players + //Bar textures + Score_NoteBarLevel_Dark : TTexture; // Note + Score_NoteBarRound_Dark : TTexture; // that's the round thing on top + + Score_NoteBarLevel_Light : TTexture; // LineBonus | Phrasebonus + Score_NoteBarRound_Light : TTexture; + + Score_NoteBarLevel_Lightest : TTexture; // GoldenNotes + Score_NoteBarRound_Lightest : TTexture; + end; + + TPlayerScoreScreenData = record // holds the positions and other data + Bar_Y :Real; + Bar_Actual_Height : Real; // this one holds the actual height of the bar, while we animate it + BarScore_ActualHeight : Real; + BarLine_ActualHeight : Real; + BarGolden_ActualHeight : Real; + end; + + TPlayerScoreRatingPics = record // a fine array of the rating pictures + RateEaseStep : Integer; + RateEaseValue: Real; + end; + + TScreenScore = class(TMenu) + private + BarTime : Cardinal; + ArrayStartModifier : integer; + public + aPlayerScoreScreenTextures : array[1..6] of TPlayerScoreScreenTexture; + aPlayerScoreScreenDatas : array[1..6] of TPlayerScoreScreenData; + aPlayerScoreScreenRatings : array[1..6] of TPlayerScoreRatingPics; + + BarScore_EaseOut_Step : real; + BarPhrase_EaseOut_Step : real; + BarGolden_EaseOut_Step : real; + + TextArtist: integer; + TextTitle: integer; + + TextArtistTitle : integer; + + TextName: array[1..6] of integer; + TextScore: array[1..6] of integer; + + TextNotes: array[1..6] of integer; + TextNotesScore: array[1..6] of integer; + TextLineBonus: array[1..6] of integer; + TextLineBonusScore: array[1..6] of integer; + TextGoldenNotes: array[1..6] of integer; + TextGoldenNotesScore: array[1..6] of integer; + TextTotal: array[1..6] of integer; + TextTotalScore: array[1..6] of integer; + + PlayerStatic: array[1..6] of array of integer; + PlayerTexts : array[1..6] of array of integer; + + + StaticBoxLightest: array[1..6] of integer; + StaticBoxLight: array[1..6] of integer; + StaticBoxDark: array[1..6] of integer; + + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + + Animation: real; + + TextScore_ActualValue : array[1..6] of integer; + TextPhrase_ActualValue : array[1..6] of integer; + TextGolden_ActualValue : array[1..6] of integer; + + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure onShowFinish; override; + function Draw: boolean; override; + procedure FillPlayer(Item, P: integer); + + procedure EaseBarIn(PlayerNumber : Integer; BarType: String); + procedure EaseScoreIn(PlayerNumber : Integer; ScoreType: String); + + procedure FillPlayerItems(PlayerNumber : Integer; ScoreType: String); + + + procedure DrawBar(BarType:string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); + + //Rating Picture + procedure ShowRating(PlayerNumber: integer); + function CalculateBouncing(PlayerNumber : Integer): real; + procedure DrawRating(PlayerNumber:integer;Rating:integer); + end; + +implementation + + +uses UGraphic, + UScreenSong, + UMenuStatic, + UTime, + UMain, + UIni, + ULog, + ULanguage; + +function TScreenScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE, + SDLK_RETURN: + begin + FadeTo(@ScreenTop5); + Exit; + end; + + SDLK_SYSREQ: + begin + Display.SaveScreenShot; + end; + end; + end; +end; + +constructor TScreenScore.Create; +var + Player: integer; + Counter: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Score); + + // These two texts arn't used in the deluxe skin + TextArtist := AddText(Theme.Score.TextArtist); + TextTitle := AddText(Theme.Score.TextTitle); + + TextArtistTitle := AddText(Theme.Score.TextArtistTitle); + + for Player := 1 to 6 do + begin + SetLength(PlayerStatic[Player], Length(Theme.Score.PlayerStatic[Player])); + SetLength(PlayerTexts[Player], Length(Theme.Score.PlayerTexts[Player])); + + for Counter := 0 to High(Theme.Score.PlayerStatic[Player]) do + PlayerStatic[Player, Counter] := AddStatic(Theme.Score.PlayerStatic[Player, Counter]); + + for Counter := 0 to High(Theme.Score.PlayerTexts[Player]) do + PlayerTexts[Player, Counter] := AddText(Theme.Score.PlayerTexts[Player, Counter]); + + TextName[Player] := AddText(Theme.Score.TextName[Player]); + TextScore[Player] := AddText(Theme.Score.TextScore[Player]); + + TextNotes[Player] := AddText(Theme.Score.TextNotes[Player]); + TextNotesScore[Player] := AddText(Theme.Score.TextNotesScore[Player]); + TextLineBonus[Player] := AddText(Theme.Score.TextLineBonus[Player]); + TextLineBonusScore[Player] := AddText(Theme.Score.TextLineBonusScore[Player]); + TextGoldenNotes[Player] := AddText(Theme.Score.TextGoldenNotes[Player]); + TextGoldenNotesScore[Player] := AddText(Theme.Score.TextGoldenNotesScore[Player]); + TextTotal[Player] := AddText(Theme.Score.TextTotal[Player]); + TextTotalScore[Player] := AddText(Theme.Score.TextTotalScore[Player]); + + StaticBoxLightest[Player] := AddStatic(Theme.Score.StaticBoxLightest[Player]); + StaticBoxLight[Player] := AddStatic(Theme.Score.StaticBoxLight[Player]); + StaticBoxDark[Player] := AddStatic(Theme.Score.StaticBoxDark[Player]); + + StaticBackLevel[Player] := AddStatic(Theme.Score.StaticBackLevel[Player]); + StaticBackLevelRound[Player] := AddStatic(Theme.Score.StaticBackLevelRound[Player]); + StaticLevel[Player] := AddStatic(Theme.Score.StaticLevel[Player]); + StaticLevelRound[Player] := AddStatic(Theme.Score.StaticLevelRound[Player]); + + //textures + aPlayerScoreScreenTextures[Player].Score_NoteBarLevel_Dark := Tex_Score_NoteBarLevel_Dark[Player]; + aPlayerScoreScreenTextures[Player].Score_NoteBarRound_Dark := Tex_Score_NoteBarRound_Dark[Player]; + + aPlayerScoreScreenTextures[Player].Score_NoteBarLevel_Light := Tex_Score_NoteBarLevel_Light[Player]; + aPlayerScoreScreenTextures[Player].Score_NoteBarRound_Light := Tex_Score_NoteBarRound_Light[Player]; + + aPlayerScoreScreenTextures[Player].Score_NoteBarLevel_Lightest := Tex_Score_NoteBarLevel_Lightest[Player]; + aPlayerScoreScreenTextures[Player].Score_NoteBarRound_Lightest := Tex_Score_NoteBarRound_Lightest[Player]; + end; + +end; + +procedure TScreenScore.onShow; +var + P: integer; // player + I: integer; + V: array[1..6] of boolean; // visibility array + +begin + +{** + * Turn backgroundmusic on + *} + SoundLib.StartBgMusic; + + inherited; + + // all statics / texts are loaded at start - so that we have them all even if we change the amount of players + // To show the corrects statics / text from the them, we simply modify the start of the according arrays + // 1 Player -> Player[0].Score (The score for one player starts at 0) + // -> Statics[1] (The statics for the one player screen start at 1) + // 2 Player -> Player[0..1].Score + // -> Statics[2..3] + // 3 Player -> Player[0..5].Score + // -> Statics[4..6] + case PlayersPlay of + 1: ArrayStartModifier := 0; + 2, 4: ArrayStartModifier := 1; + 3, 6: ArrayStartModifier := 3; + else + ArrayStartModifier := 0; //this should never happen + end; + + for P := 1 to PlayersPlay do + begin + // data + aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[P + ArrayStartModifier].Y; + + // ratings + aPlayerScoreScreenRatings[P].RateEaseStep := 1; + aPlayerScoreScreenRatings[P].RateEaseValue := 20; + end; + + + Text[TextArtist].Text := CurrentSong.Artist; + Text[TextTitle].Text := CurrentSong.Title; + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; + + // set visibility + case PlayersPlay of + 1: begin + V[1] := true; + V[2] := false; + V[3] := false; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 2, 4: begin + V[1] := false; + V[2] := true; + V[3] := true; + V[4] := false; + V[5] := false; + V[6] := false; + end; + 3, 6: begin + V[1] := false; + V[2] := false; + V[3] := false; + V[4] := true; + V[5] := true; + V[6] := true; + end; + end; + + for P := 1 to 6 do + begin + Text[TextName[P]].Visible := V[P]; + Text[TextScore[P]].Visible := V[P]; + + // We set alpha to 0 , so we can nicely blend them in when we need them + Text[TextScore[P]].Alpha := 0; + Text[TextNotesScore[P]].Alpha := 0; + Text[TextNotes[P]].Alpha := 0; + Text[TextLineBonus[P]].Alpha := 0; + Text[TextLineBonusScore[P]].Alpha := 0; + Text[TextGoldenNotes[P]].Alpha := 0; + Text[TextGoldenNotesScore[P]].Alpha := 0; + Text[TextTotal[P]].Alpha := 0; + Text[TextTotalScore[P]].Alpha := 0; + Static[StaticBoxLightest[P]].Texture.Alpha := 0; + Static[StaticBoxLight[P]].Texture.Alpha := 0; + Static[StaticBoxDark[P]].Texture.Alpha := 0; + + + Text[TextNotes[P]].Visible := V[P]; + Text[TextNotesScore[P]].Visible := V[P]; + Text[TextLineBonus[P]].Visible := V[P]; + Text[TextLineBonusScore[P]].Visible := V[P]; + Text[TextGoldenNotes[P]].Visible := V[P]; + Text[TextGoldenNotesScore[P]].Visible := V[P]; + Text[TextTotal[P]].Visible := V[P]; + Text[TextTotalScore[P]].Visible := V[P]; + + for I := 0 to high(PlayerStatic[P]) do + Static[PlayerStatic[P, I]].Visible := V[P]; + + for I := 0 to high(PlayerTexts[P]) do + Text[PlayerTexts[P, I]].Visible := V[P]; + + Static[StaticBoxLightest[P]].Visible := V[P]; + Static[StaticBoxLight[P]].Visible := V[P]; + Static[StaticBoxDark[P]].Visible := V[P]; + + // we draw that on our own + Static[StaticBackLevel[P]].Visible := false; + Static[StaticBackLevelRound[P]].Visible := false; + Static[StaticLevel[P]].Visible := false; + Static[StaticLevelRound[P]].Visible := false; + end; +end; + +procedure TScreenScore.onShowFinish; +var + index : integer; +begin + for index := 1 to (PlayersPlay) do + begin + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; +end; + +function TScreenScore.Draw: boolean; +var + CurrentTime : Cardinal; + PlayerCounter : integer; +begin + + inherited Draw; +{* + player[0].ScoreInt := 7000; + player[0].ScoreLineInt := 2000; + player[0].ScoreGoldenInt := 1000; + player[0].ScoreTotalInt := 10000; + + player[1].ScoreInt := 2500; + player[1].ScoreLineInt := 1100; + player[1].ScoreGoldenInt := 900; + player[1].ScoreTotalInt := 4500; +*} + // Let's start to arise the bars + CurrentTime := SDL_GetTicks(); + if((CurrentTime >= BarTime) AND ShowFinish) then + begin + BarTime := CurrentTime + BarRaiseSpeed; + + for PlayerCounter := 1 to PlayersPlay do + begin + // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarScore_EaseOut_Step:= BarScore_EaseOut_Step + 1; + + // PhrasenBonus + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; + + + // GoldenNotebonus + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + + // Draw golden score bar # + EaseBarIn(PlayerCounter, 'Golden'); + EaseScoreIn(PlayerCounter,'Golden'); + end; + + // Draw phrase score bar # + EaseBarIn(PlayerCounter, 'Line'); + EaseScoreIn(PlayerCounter,'Line'); + end; + + // Draw plain score bar # + EaseBarIn(PlayerCounter, 'Note'); + EaseScoreIn(PlayerCounter,'Note'); + + + FillPlayerItems(PlayerCounter,'Funky'); + + end; + end; + + +(* + //todo: i need a clever method to draw statics with their z value + for I := 0 to Length(Static) - 1 do + Static[I].Draw; + for I := 0 to Length(Text) - 1 do + Text[I].Draw; +*) + + Result := true; +end; + +procedure TscreenScore.FillPlayerItems(PlayerNumber : Integer; ScoreType: String); +var + ThemeIndex: integer; +begin + // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) + Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; + // end todo + + ThemeIndex := PlayerNumber + ArrayStartModifier; + + //golden + Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); + Text[TextGoldenNotesScore[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); + + Static[StaticBoxLightest[ThemeIndex]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); + + // line bonus + Text[TextLineBonusScore[ThemeIndex]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); + Text[TextLineBonusScore[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); + + Static[StaticBoxLight[ThemeIndex]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); + + // plain score + Text[TextNotesScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); + Text[TextNotes[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + + Static[StaticBoxDark[ThemeIndex]].Texture.Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + + // total score + Text[TextTotalScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]); + Text[TextTotalScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + + Text[TextTotal[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + + if(BarGolden_EaseOut_Step = 100) then + begin + ShowRating(PlayerNumber); + end; +end; + + +procedure TScreenScore.ShowRating(PlayerNumber: integer); +var + Rating : integer; + ThemeIndex : integer; +begin + + ThemeIndex := PlayerNumber + ArrayStartModifier; + + case (Player[PlayerNumber-1].ScoreTotalInt) of + 0..2009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..5009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_WANNABE'); + Rating := 2; + end; + 5010..6009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_HOPEFUL'); + Rating := 3; + end; + 6010..7509: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 4; + end; + 7510..8509: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 5; + end; + 8510..9009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 6; + end; + 9010..10000: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 7; + end; + else + Rating := 0; // Cheata :P + end; + + //todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + if ( Theme.Score.StaticRatings[ThemeIndex].W > 0 ) AND ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + begin + Text[TextScore[ThemeIndex]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / Theme.Score.StaticRatings[ThemeIndex].W; + end; + // end todo + + DrawRating(PlayerNumber, Rating); +end; + +procedure TscreenScore.DrawRating(PlayerNumber:integer;Rating:integer); +var + Posx : real; + Posy : real; + Width :real; +begin + + CalculateBouncing(PlayerNumber); + + PosX := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].X + (Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].W * 0.5); + PosY := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].Y + (Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].H * 0.5); ; + + Width := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue/2; + + glBindTexture(GL_TEXTURE_2D, Tex_Score_Ratings[Rating].TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex2f(PosX - Width, PosY - Width); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, 0); glVertex2f(PosX + Width, PosY - Width); + glTexCoord2f(Tex_Score_Ratings[Rating].TexW, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX + Width, PosY + Width); + glTexCoord2f(0, Tex_Score_Ratings[Rating].TexH); glVertex2f(PosX - Width, PosY + Width); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); +end; + + + +function TscreenScore.CalculateBouncing(PlayerNumber : Integer): real; +var + ReturnValue : real; + p, s : real; + + RaiseStep, MaxVal : real; + EaseOut_Step : integer; +begin + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; + MaxVal := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].W; + + RaiseStep := EaseOut_Step; + + if (MaxVal > 0) AND (RaiseStep > 0) then + RaiseStep := RaiseStep / MaxVal; + + if (RaiseStep = 1) then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; + + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; + + Result := ReturnValue; +end; + + +procedure TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String); +const + RaiseSmoothness : integer = 100; +var + MaxHeight : real; + NewHeight : real; + + Height2Reach : real; + RaiseStep : real; + BarStartPosY : single; + + lTmp : real; + Score : integer; +begin + MaxHeight := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].H; + + // let's get the points according to the bar we draw + // score array starts at 0, which means the score for player 1 is in score[0] + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + if (BarType = 'Note') then + begin + Score := Player[PlayerNumber - 1].ScoreInt; + RaiseStep := BarScore_EaseOut_Step; + BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y + MaxHeight; + end + else if (BarType = 'Line') then + begin + Score := Player[PlayerNumber - 1].ScoreLineInt; + RaiseStep := BarPhrase_EaseOut_Step; + BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight; + end + else if (BarType = 'Golden') then + begin + Score := Player[PlayerNumber - 1].ScoreGoldenInt; + RaiseStep := BarGolden_EaseOut_Step; + BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight; + end + else + begin + Log.LogCritical('Unknown bar-type: ' + BarType, 'TScreenScore.EaseBarIn'); + Exit; // suppress warnings + end; + + // the height dependend of the score + Height2Reach := (Score / MAX_SONG_SCORE) * MaxHeight; + + if (aPlayerScoreScreenDatas[PlayerNumber].Bar_Actual_Height < Height2Reach) then + begin + // Check http://proto.layer51.com/d.aspx?f=400 for more info on easing functions + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + lTmp := (-Height2Reach * RaiseStep * (RaiseStep - 20) + BarStartPosY); + + if ( RaiseSmoothness > 0 ) and ( lTmp > 0 ) then + NewHeight := lTmp / RaiseSmoothness; + + end + else + NewHeight := Height2Reach; + + DrawBar(BarType, PlayerNumber, BarStartPosY, NewHeight); + + if (BarType = 'Note') then + aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight := NewHeight + else if (BarType = 'Line') then + aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight := NewHeight + else if (BarType = 'Golden') then + aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight; +end; + +procedure TscreenScore.DrawBar(BarType:string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); +var + Width:real; + BarStartPosX:real; +begin + // this is solely for better readability of the drawing + Width := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].W; + BarStartPosX := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].X; + + glColor4f(1, 1, 1, 1); + + // set the texture for the bar + if (BarType = 'Note') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Dark.TexNum); + if (BarType = 'Line') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Light.TexNum); + if (BarType = 'Golden') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Lightest.TexNum); + + //draw it + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY, ZBars); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); + + //the round thing on top + if (BarType = 'Note') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Dark.TexNum); + if (BarType = 'Line') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Light.TexNum); + if (BarType = 'Golden') then + glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Lightest.TexNum); + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glBegin(GL_QUADS); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + ArrayStartModifier]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + ArrayStartModifier]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); + glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); + glEnd; + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2d); +end; + +procedure TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType : String); +const + RaiseSmoothness : integer = 100; +var + RaiseStep : Real; + lTmpA : Real; + ScoreReached :Integer; + EaseOut_Step :Real; + ActualScoreValue:integer; +begin + if (ScoreType = 'Note') then + begin + EaseOut_Step := BarScore_EaseOut_Step; + ActualScoreValue := TextScore_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreInt; + end; + if (ScoreType = 'Line') then + begin + EaseOut_Step := BarPhrase_EaseOut_Step; + ActualScoreValue := TextPhrase_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreLineInt; + end; + if (ScoreType = 'Golden') then + begin + EaseOut_Step := BarGolden_EaseOut_Step; + ActualScoreValue := TextGolden_ActualValue[PlayerNumber]; + ScoreReached := Player[PlayerNumber-1].ScoreGoldenInt; + end; + + // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps + RaiseStep := EaseOut_Step; + + if (ActualScoreValue < ScoreReached) then + begin + // Calculate the actual step according to the maxsteps + RaiseStep := RaiseStep / EaseOut_MaxSteps; + + // quadratic easing out - decelerating to zero velocity + // -end_position * current_time * ( current_time - 2 ) + start_postion + lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); + if ( lTmpA > 0 ) AND + ( RaiseSmoothness > 0 ) then + begin + if (ScoreType = 'Note') then + TextScore_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + if (ScoreType = 'Line') then + TextPhrase_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + if (ScoreType = 'Golden') then + TextGolden_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); + end; + end + else + begin + if (ScoreType = 'Note') then + TextScore_ActualValue[PlayerNumber] := ScoreReached; + if (ScoreType = 'Line') then + TextPhrase_ActualValue[PlayerNumber] := ScoreReached; + if (ScoreType = 'Golden') then + TextGolden_ActualValue[PlayerNumber] := ScoreReached; + end; +end; + +procedure TScreenScore.FillPlayer(Item, P: integer); +var + S: string; +begin + Text[TextName[Item]].Text := Ini.Name[P]; + + S := IntToStr((Round(Player[P].Score) div 10) * 10); + while (Length(S)<4) do + S := '0' + S; + Text[TextNotesScore[Item]].Text := S; + + // while (Length(S)<5) do S := '0' + S; + // Text[TextTotalScore[Item]].Text := S; + + //fixed: line bonus and golden notes don't show up, + // another bug: total score was shown without added golden-, linebonus + S := IntToStr(Player[P].ScoreTotalInt); + while (Length(S)<5) do + S := '0' + S; + Text[TextTotalScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreLineInt); + while (Length(S)<4) do + S := '0' + S; + Text[TextLineBonusScore[Item]].Text := S; + + S := IntToStr(Player[P].ScoreGoldenInt); + while (Length(S)<4) do + S := '0' + S; + Text[TextGoldenNotesScore[Item]].Text := S; + //end of fix + + +end; + +end. diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas new file mode 100644 index 00000000..911d122e --- /dev/null +++ b/src/screens/UScreenSing.pas @@ -0,0 +1,934 @@ +unit UScreenSing; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + UThemes, + UGraphicClasses, + USingScores; + +type + TLyricsSyncSource = class(TSyncSource) + function GetClock(): real; override; + end; + +type + TScreenSing = class(TMenu) + protected + Paused: boolean; //Pause Mod + LyricsSync: TLyricsSyncSource; + NumEmptySentences: integer; + public + //TextTime: integer; + + // TimeBar fields + StaticTimeProgress: integer; + TextTimeText: integer; + + StaticP1: integer; + TextP1: integer; + + //shown when game is in 2/4 player modus + StaticP1TwoP: integer; + TextP1TwoP: integer; + + //shown when game is in 3/6 player modus + StaticP1ThreeP: integer; + TextP1ThreeP: integer; + + StaticP2R: integer; + TextP2R: integer; + + StaticP2M: integer; + TextP2M: integer; + + StaticP3R: integer; + TextP3R: integer; + + StaticPausePopup: integer; + + Tex_Background: TTexture; + FadeOut: boolean; + Lyrics: TLyricEngine; + + //Score Manager: + Scores: TSingScores; + + fShowVisualization: boolean; + fCurrentVideoPlaybackEngine: IVideoPlayback; + + constructor Create; override; + procedure onShow; override; + procedure onShowFinish; override; + + function ParseInput(PressedKey: cardinal; CharCode: widechar; + PressedDown: boolean): boolean; override; + function Draw: boolean; override; + + procedure Finish; virtual; + procedure Pause; // Toggle Pause + + procedure OnSentenceEnd(SentenceIndex: cardinal); // for LineBonus + Singbar + procedure OnSentenceChange(SentenceIndex: cardinal); // for Golden Notes + end; + +implementation + +uses UGraphic, + UDraw, + UMain, + USong, + 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; CharCode: widechar; + PressedDown: boolean): boolean; +begin + Result := True; + if (PressedDown) then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + '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; + Exit; + end; + 'V': //Show Visualization + begin + fShowVisualization := not fShowVisualization; + + if fShowVisualization then + fCurrentVideoPlaybackEngine := Visualization + else + fCurrentVideoPlaybackEngine := VideoPlayback; + + if fShowVisualization then + fCurrentVideoPlaybackEngine.play; + + Exit; + end; + 'P': + begin + Pause; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE: + begin + //Record Sound Hack: + //Sound[0].BufferLong + + Finish; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenScore); + end; + + SDLK_SPACE: + begin + Pause; + end; + + SDLK_TAB: //Change Visualization Preset + begin + if fShowVisualization then + fCurrentVideoPlaybackEngine.Position := now; // move to a random position + 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 //enable Pause + begin + // pause Time + Paused := True; + + LyricsState.Pause(); + + // pause Music + AudioPlayback.Pause; + + // pause Video + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause; + + end + else //disable Pause + begin + LyricsState.Resume(); + + // Play Music + AudioPlayback.Play; + + // Video + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + + CurrentSong.Video) then + fCurrentVideoPlaybackEngine.Pause; + + Paused := False; + end; +end; +//Pause Mod End + +constructor TScreenSing.Create; +var + I: integer; + P: integer; +begin + inherited Create; + + fShowVisualization := False; + + fCurrentVideoPlaybackEngine := VideoPlayback; + + //Create Score Class + Scores := TSingScores.Create; + Scores.LoadfromTheme; + + LoadFromTheme(Theme.Sing); + + //TimeBar + StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); + TextTimeText := AddText(Theme.Sing.TextTimeText); + + // 1 player | P1 + StaticP1 := AddStatic(Theme.Sing.StaticP1); + TextP1 := AddText(Theme.Sing.TextP1); + + // 2 or 4 players | P1 + StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); + TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); + + // | P2 + StaticP2R := AddStatic(Theme.Sing.StaticP2R); + TextP2R := AddText(Theme.Sing.TextP2R); + + // 3 or 6 players | P1 + StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); + TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); + + // | P2 + StaticP2M := AddStatic(Theme.Sing.StaticP2M); + TextP2M := AddText(Theme.Sing.TextP2M); + + // | P3 + StaticP3R := AddStatic(Theme.Sing.StaticP3R); + TextP3R := AddText(Theme.Sing.TextP3R); + + StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); + + //Pausepopup is not visibile at the beginning + Static[StaticPausePopup].Visible := False; + + Lyrics := TLyricEngine.Create(80, Skin_LyricsT, 640, 12, 80, Skin_LyricsT + 36, 640, 12); + + LyricsSync := TLyricsSyncSource.Create(); +end; + +procedure TScreenSing.onShow; +var + P: integer; + V1: boolean; + V1TwoP: boolean; //Position of ScoreBox in two-player mode + V1ThreeP: boolean; //Position of ScoreBox in three-player mode + V2R: boolean; + V2M: boolean; + V3R: boolean; + NR: TRecR; //Some enlightment of who, how and what this is here please + Color: TRGB; + + success: boolean; +begin + inherited; + + Log.LogStatus('Begin', 'onShow'); + FadeOut := False; + + // reset video playback engine, to play Video Clip... + fCurrentVideoPlaybackEngine := VideoPlayback; + + // setup score manager + Scores.ClearPlayers; // clear old player values + Color.R := 0; + Color.G := 0; + Color.B := 0; // dummy atm <- \(O.o)/? B like bummy? + + // add new players + for P := 0 to PlayersPlay - 1 do + begin + Scores.AddPlayer(Tex_ScoreBG[P], Color); + end; + + Scores.Init; //Get Positions for Players + + // prepare players + SetLength(Player, PlayersPlay); + + case PlayersPlay of + 1: + begin + V1 := True; + V1TwoP := False; + V1ThreeP := False; + V2R := False; + V2M := False; + V3R := False; + end; + 2: + begin + V1 := False; + V1TwoP := True; + V1ThreeP := False; + V2R := True; + V2M := False; + V3R := False; + end; + 3: + begin + V1 := False; + V1TwoP := False; + V1ThreeP := True; + V2R := False; + V2M := True; + V3R := True; + end; + 4: + begin // double screen + V1 := False; + V1TwoP := True; + V1ThreeP := False; + V2R := True; + V2M := False; + V3R := False; + end; + 6: + begin // double screen + V1 := False; + V1TwoP := False; + V1ThreeP := True; + V2R := False; + V2M := True; + V3R := True; + end; + + end; + + //This one is shown in 1P mode + Static[StaticP1].Visible := V1; + Text[TextP1].Visible := V1; + + + //This one is shown in 2/4P mode + Static[StaticP1TwoP].Visible := V1TwoP; + Text[TextP1TwoP].Visible := V1TwoP; + + Static[StaticP2R].Visible := V2R; + Text[TextP2R].Visible := V2R; + + + //This one is shown in 3/6P mode + Static[StaticP1ThreeP].Visible := V1ThreeP; + Text[TextP1ThreeP].Visible := V1ThreeP; + + + Static[StaticP2M].Visible := V2M; + Text[TextP2M].Visible := V2M; + + + Static[StaticP3R].Visible := V3R; + Text[TextP3R].Visible := V3R; + + + // FIXME: sets Path and Filename to '' + ResetSingTemp; + + CurrentSong := CatSongs.Song[CatSongs.Selected]; + + // FIXME: bad style, put the try-except into LoadSong() and not here + try + // Check if file is XML + if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then + success := CurrentSong.LoadXMLSong() + else + success := CurrentSong.LoadSong(); + except + success := False; + end; + + if (not success) then + begin + // error loading song -> go back to song screen and show some error message + FadeTo(@ScreenSong); + // select new song in party mode + if ScreenSong.Mode = smPartyMode then + ScreenSong.SelectRandomSong(); + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); + // FIXME: do we need this? + CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; + Exit; + end; + + // reset video playback engine, to play video clip... + fCurrentVideoPlaybackEngine.Close; + fCurrentVideoPlaybackEngine := VideoPlayback; +{** + * == Background == + * We have four types of backgrounds: + * + Blank : Nothing has been set, this is our fallback + * + Picture : Picture has been set, and exists - otherwise we fallback + * + Video : Video has been set, and exists - otherwise we fallback + * + Visualization: + Off : No Visialization + * + WhenNoVideo: Overwrites Blank and Picture + * + On : Overwrites Blank, Picture and Video + *} +{** + * set background to: video + *} + CurrentSong.VideoLoaded := False; + fShowVisualization := False; + if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + begin + if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then + begin + fShowVisualization := False; + fCurrentVideoPlaybackEngine := VideoPlayback; + fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; + CurrentSong.VideoLoaded := True; + fCurrentVideoPlaybackEngine.play; + end; + end; + +{** + * set background to: picture + *} + if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) + and (TVisualizerOption(Ini.VisualizerOption) = voOff) then + try + Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); + except + Log.LogError('Background could not be loaded: ' + CurrentSong.Path + + CurrentSong.Background); + Tex_Background.TexNum := 0; + end + else + Tex_Background.TexNum := 0; +{** + * set background to: visualization (Overwrites all) + *} + if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then + begin + fShowVisualization := True; + fCurrentVideoPlaybackEngine := Visualization; + fCurrentVideoPlaybackEngine.play; + end; + +{** + * set background to: visualization (Videos are still shown) + *} + if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and + (CurrentSong.VideoLoaded = False)) then + begin + fShowVisualization := True; + fCurrentVideoPlaybackEngine := Visualization; + fCurrentVideoPlaybackEngine.play; + end; + + // prepare lyrics timer + LyricsState.Reset(); + LyricsState.SetCurrentTime(CurrentSong.Start); + LyricsState.StartTime := CurrentSong.Gap; + if (CurrentSong.Finish > 0) then + LyricsState.TotalTime := CurrentSong.Finish / 1000 + else + LyricsState.TotalTime := AudioPlayback.Length; + LyricsState.UpdateBeats(); + + // prepare music + AudioPlayback.Stop(); + AudioPlayback.Position := CurrentSong.Start; + // synchronize music to the lyrics + AudioPlayback.SetSyncSource(LyricsSync); + + // prepare and start voice-capture + AudioInput.CaptureStart; + + for P := 0 to High(Player) do + ClearScores(P); + + // main text + Lyrics.Clear(CurrentSong.BPM[0].BPM, CurrentSong.Resolution); + + // set custom options + case Ini.LyricsFont of + 0: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 0; + + Lyrics.LineColor_en.R := Skin_FontR; + Lyrics.LineColor_en.G := Skin_FontG; + Lyrics.LineColor_en.B := Skin_FontB; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.4; + Lyrics.LineColor_dis.G := 0.4; + Lyrics.LineColor_dis.B := 0.4; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 5 / 256; + Lyrics.LineColor_act.G := 163 / 256; + Lyrics.LineColor_act.B := 210 / 256; + Lyrics.LineColor_act.A := 1; + end; + 1: + begin + Lyrics.UpperLineSize := 14; + Lyrics.LowerLineSize := 14; + Lyrics.FontStyle := 2; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; + end; + 2: + begin + Lyrics.UpperLineSize := 12; + Lyrics.LowerLineSize := 12; + Lyrics.FontStyle := 3; + + Lyrics.LineColor_en.R := 0.75; + Lyrics.LineColor_en.G := 0.75; + Lyrics.LineColor_en.B := 1; + Lyrics.LineColor_en.A := 1; + + Lyrics.LineColor_dis.R := 0.8; + Lyrics.LineColor_dis.G := 0.8; + Lyrics.LineColor_dis.B := 0.8; + Lyrics.LineColor_dis.A := 1; + + Lyrics.LineColor_act.R := 0.5; + Lyrics.LineColor_act.G := 0.5; + Lyrics.LineColor_act.B := 1; + Lyrics.LineColor_act.A := 1; + end; + end; // case + + // Initialize lyrics by filling its queue + while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= + High(Lines[0].Line)) do + begin + Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); + end; + + // Deactivate pause + Paused := False; + + // Kill all stars not killed yet (GoldenStarsTwinkle Mod) + GoldenRec.SentenceChange; + + // set Position of Line Bonus - Line Bonus end + // set number of empty sentences for Line Bonus + NumEmptySentences := 0; + for P := Low(Lines[0].Line) to High(Lines[0].Line) do + if Lines[0].Line[P].TotalNotes = 0 then + Inc(NumEmptySentences); + + Log.LogStatus('End', 'onShow'); +end; + +procedure TScreenSing.onShowFinish; +begin + // start lyrics + LyricsState.Resume(); + + // start music + AudioPlayback.Play(); + + // start timer + CountSkipTimeSet; +end; + +function TScreenSing.Draw: boolean; +var + Min: integer; + Sec: integer; + Tekst: string; + Flash: real; + S: integer; + T: integer; + CurLyricsTime: real; +begin + + // 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 + 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 + + + //// + // dual screen, part 1 + //////////////////////// + + // Note: ScreenX is the offset of the current screen in dual-screen mode so we + // will move the statics and texts to the correct screen here. + // FIXME: clean up this weird stuff. Commenting this stuff out, nothing + // was missing on screen w/ 6 players - so do we even need this stuff? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + + Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + + Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // end of weird stuff + + Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10 * ScreenX; + + + + // retrieve current lyrics time, we have to store the value to avoid + // that min- and sec-values do not match + CurLyricsTime := LyricsState.GetCurrentTime(); + Min := Round(CurLyricsTime) div 60; + Sec := Round(CurLyricsTime) mod 60; + + // update static menu with time ... + 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); + + // draw static menu (BG) + // Note: there is no menu and the animated background brakes the video playback + //DrawBG; + + // Draw Background + SingDrawBackground; + + // update and draw movie + if (ShowFinish and (CurrentSong.VideoLoaded or fShowVisualization)) then + begin + if assigned(fCurrentVideoPlaybackEngine) then + begin + fCurrentVideoPlaybackEngine.GetFrame(LyricsState.GetCurrentTime()); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + end; + end; + + // draw static menu (FG) + DrawFG; + + // check for music finish + //Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish)); + if ShowFinish then + begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) then + begin + // analyze song if not paused + if (not Paused) then + Sing(Self); + end + else + begin + if (not FadeOut) then + begin + Finish; + FadeOut := True; + FadeTo(@ScreenScore); + end; + end; + end; + + // always draw custom items + SingDraw; + + //GoldenNoteStarsTwinkle + GoldenRec.SpawnRec; + + //Draw Scores + Scores.Draw; + + //// + // dual screen, part 2 + //////////////////////// + + // Note: ScreenX is the offset of the current screen in dual-screen mode so we + // will move the statics and texts to the correct screen here. + // FIXME: clean up this weird stuff + + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; + + //end of weird + + Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10 * ScreenX; + + // Draw Pausepopup + // FIXME: this is a workaround that the Static is drawn over the Lyrics, Lines, Scores and Effects + // maybe someone could find a better solution + if Paused then + begin + Static[StaticPausePopup].Visible := True; + Static[StaticPausePopup].Draw; + Static[StaticPausePopup].Visible := False; + end; + + Result := True; +end; + +procedure TScreenSing.Finish; +begin + AudioInput.CaptureStop; + AudioPlayback.Stop; + AudioPlayback.SetSyncSource(nil); + + 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 CurrentSong.VideoLoaded then + begin + fCurrentVideoPlaybackEngine.Close; + CurrentSong.VideoLoaded := False; // to prevent drawing closed video + end; + + SetFontItalic(False); +end; + +procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); +var + PlayerIndex: integer; + CurrentPlayer: PPLayer; + CurrentScore: real; + Line: PLine; + LinePerfection: real; // perfection of singing performance on the current line + Rating: integer; + LineScore: real; + LineBonus: real; + MaxSongScore: integer; // max. points for the song (without line bonus) + MaxLineScore: real; // max. points for the current line +const + // TODO: move this to a better place + MAX_LINE_RATING = 8; // max. rating for singing performance +begin + Line := @Lines[0].Line[SentenceIndex]; + + // check for empty sentence + if (Line.TotalNotes <= 0) then + Exit; + + // set max song score + if (Ini.LineBonus = 0) then + MaxSongScore := MAX_SONG_SCORE + else + MaxSongScore := MAX_SONG_SCORE - MAX_SONG_LINE_BONUS; + + // Note: ScoreValue is the sum of all note values of the song + MaxLineScore := MaxSongScore * (Line.TotalNotes / Lines[0].ScoreValue); + + for PlayerIndex := 0 to High(Player) do + begin + CurrentPlayer := @Player[PlayerIndex]; + CurrentScore := CurrentPlayer.Score + CurrentPlayer.ScoreGolden; + + // Line Bonus + + // points for this line + LineScore := CurrentScore - CurrentPlayer.ScoreLast; + + // determine LinePerfection + // Note: the "+2" extra points are a little bonus so the player does not + // have to be that perfect to reach the bonus steps. + LinePerfection := (LineScore + 2) / MaxLineScore; + + // clamp LinePerfection to range [0..1] + if (LinePerfection < 0) then + LinePerfection := 0 + else if (LinePerfection > 1) then + LinePerfection := 1; + + // add line-bonus if enabled + if (Ini.LineBonus > 0) then + begin + // line-bonus points (same for each line, no matter how long the line is) + LineBonus := MAX_SONG_LINE_BONUS / (Length(Lines[0].Line) - + NumEmptySentences); + // apply line-bonus + CurrentPlayer.ScoreLine := + CurrentPlayer.ScoreLine + LineBonus * LinePerfection; + CurrentPlayer.ScoreLineInt := Round(CurrentPlayer.ScoreLine / 10) * 10; + // update total score + CurrentPlayer.ScoreTotalInt := + CurrentPlayer.ScoreInt + + CurrentPlayer.ScoreGoldenInt + + CurrentPlayer.ScoreLineInt; + + // spawn rating pop-up + Rating := Round(LinePerfection * MAX_LINE_RATING); + Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); + end; + + // PerfectLineTwinkle (effect), Part 1 + if (Ini.EffectSing = 1) then + CurrentPlayer.LastSentencePerfect := (LinePerfection >= 1); + + // refresh last score + CurrentPlayer.ScoreLast := CurrentScore; + end; + + // PerfectLineTwinkle (effect), Part 2 + if (Ini.EffectSing = 1) then + GoldenRec.SpawnPerfectLineTwinkle; +end; + + // Called on sentence change + // SentenceIndex: index of the new active sentence +procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); +var + LyricEngine: TLyricEngine; +begin + //GoldenStarsTwinkle + GoldenRec.SentenceChange; + + // Fill lyrics queue and set upper line to the current sentence + while (Lyrics.GetUpperLineIndex() < SentenceIndex) or + (not Lyrics.IsQueueFull) do + begin + // Add the next line to the queue or a dummy if no more lines are available + if (Lyrics.LineCounter <= High(Lines[0].Line)) then + Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]) + else + Lyrics.AddLine(nil); + end; + + // AddLine draws the passed line to the back-buffer of the render context + // and copies it into a texture afterwards (offscreen rendering). + // This leaves an in invalidated screen. Calling Draw() makes sure, + // that the back-buffer stores the sing-screen, when the next + // swap between the back- and front-buffer is done (eliminates flickering) + // calling AddLine() right before the regular screen update (Display.Draw) + // would be a better solution. + Draw; +end; + +function TLyricsSyncSource.GetClock(): real; +begin + Result := LyricsState.GetCurrentTime(); +end; + +end. + diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas new file mode 100644 index 00000000..616ba1c1 --- /dev/null +++ b/src/screens/UScreenSingModi.pas @@ -0,0 +1,707 @@ +unit UScreenSingModi; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + + UThemes, + //ULCD, //TODO: maybe LCD Support as Plugin? + 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; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure Finish; override; + //procedure UpdateLCD; //TODO: maybe LCD Support as Plugin? + //procedure Pause; //Pause Mod(Toggles Pause) + end; + +type + TCustomSoundEntry = record + Filename : String; + Stream : TAudioPlaybackStream; + end; + +var + //Custom Sounds + CustomSounds: array of TCustomSoundEntry; + +//Procedured for Plugin +function LoadTex (const Name: PChar; Typ: TTextureType): 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 Lines: TLines): 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; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + case PressedKey of + + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Finish; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenPartyScore); + end; + + else + Result := inherited ParseInput(PressedKey, CharCode, PressedDown); + end; + end; +end; + +constructor TScreenSingModi.Create; +begin + inherited Create; + +end; + +function ToSentences(Const Lines: TLines): TSentences; +var + I, J: Integer; +begin + Result.Current := Lines.Current; + Result.High := Lines.High; + Result.Number := Lines.Number; + Result.Resolution := Lines.Resolution; + Result.NotesGAP := Lines.NotesGAP; + Result.TotalLength := Lines.ScoreValue; + + SetLength(Result.Sentence, Length(Lines.Line)); + for I := low(Result.Sentence) to high(Result.Sentence) do + begin + Result.Sentence[I].Start := Lines.Line[I].Start; + Result.Sentence[I].StartNote := Lines.Line[I].Note[0].Start; + Result.Sentence[I].Lyric := Lines.Line[I].Lyric; + Result.Sentence[I].LyricWidth := Lines.Line[I].LyricWidth; + Result.Sentence[I].End_ := Lines.Line[I].End_; + Result.Sentence[I].BaseNote := Lines.Line[I].BaseNote; + Result.Sentence[I].HighNote := Lines.Line[I].HighNote; + Result.Sentence[I].TotalNotes := Lines.Line[I].TotalNotes; + + SetLength(Result.Sentence[I].Note, Length(Lines.Line[I].Note)); + for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do + begin + Result.Sentence[I].Note[J].Color := Lines.Line[I].Note[J].Color; + Result.Sentence[I].Note[J].Start := Lines.Line[I].Note[J].Start; + Result.Sentence[I].Note[J].Length := Lines.Line[I].Note[J].Length; + Result.Sentence[I].Note[J].Tone := Lines.Line[I].Note[J].Tone; + //Result.Sentence[I].Note[J].Text := Lines.Line[I].Note[J].Tekst; + Result.Sentence[I].Note[J].FreeStyle := (Lines.Line[I].Note[J].NoteType = ntFreestyle); + end; + end; +end; + +procedure TScreenSingModi.onShow; +var + I: Integer; +begin + inherited; + + PlayersPlay := TeamInfo.NumTeams; + + if DLLMan.Selected.LoadSong then //Start with Song + begin + inherited; + end + else //Start Without Song + begin + AudioInput.CaptureStart; + end; + +//Set Playerinfo + PlayerInfo.NumPlayers := PlayersPlay; + for I := 0 to PlayerInfo.NumPlayers-1 do + begin + PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); + PlayerInfo.Playerinfo[I].Score := 0; + PlayerInfo.Playerinfo[I].Bar := 50; + PlayerInfo.Playerinfo[I].Enabled := True; + end; + + for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do + begin + PlayerInfo.Playerinfo[I].Score:= 0; + PlayerInfo.Playerinfo[I].Bar := 0; + PlayerInfo.Playerinfo[I].Enabled := False; + end; + + {Case PlayersPlay of + 1: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; + end; + 2,4: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; + end; + 3,6: begin + PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; + PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; + PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; + PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; + PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; + PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; + end; + end; } + + // play music (I) + //Music.CaptureStart; + //Music.MoveTo(AktSong.Start); + + //Init Plugin + if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Lines[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; + CurLyricsTime: real; +begin + Result := false; + + //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].ScoreTotalInt <= MAX_SONG_SCORE) then + PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalInt; + PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); + end; + end; + + //Show Score + if DLLMan.Selected.ShowScore then + begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + + + // stereo <- and where iss P2M? or P3? + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; + Text[TextP1].X := Text[TextP1].X + 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1Score].Text := Tekst; + end; + + if PlayersPlay = 2 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + + if PlayersPlay = 3 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1TwoPScore].Text := Tekst; + + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2RScore].Text := Tekst; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + Tekst := IntToStr(Player[0].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[1].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[2].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + if ScreenAct = 2 then begin + Tekst := IntToStr(Player[3].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP1ThreePScore].Text := Tekst; + + Tekst := IntToStr(Player[4].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP2MScore].Text := Tekst; + + Tekst := IntToStr(Player[5].ScoreTotalI); + while Length(Tekst) < 5 do Tekst := '0' + Tekst; + Text[TextP3RScore].Text := Tekst; + end; + end; } + + end; //ShowScore + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X + 10*ScreenX; + + if DLLMan.Selected.LoadSong then + begin + // update static menu with time ... + CurLyricsTime := LyricsState.GetCurrentTime(); + Min := Round(CurLyricsTime) div 60; + Sec := Round(CurLyricsTime) mod 60; + + Text[TextTimeText].Text := ''; + if Min < 10 then Text[TextTimeText].Text := '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Min) + ':'; + if Sec < 10 then Text[TextTimeText].Text := Text[TextTimeText].Text + '0'; + Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); + end; + + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + + // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? + // update and draw movie + // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X +{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin + UpdateSmpeg; // this only draws + end;} + + // draw static menu (FG) + DrawFG; + + if ShowFinish then begin + if DllMan.Selected.LoadSong then + begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.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].ScoreTotalInt; + end; + end; + + if ((ShowFinish) AND (NOT Paused)) then + begin + if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) 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].ScoreTotalInt <> PlayerInfo.Playerinfo[I].Score) then + begin + //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); + Player[I].ScoreTotalInt := PlayerInfo.Playerinfo[I].Score; + end; + {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then + Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } + end; + + // back stereo + Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; + Text[TextP1].X := Text[TextP1].X - 10*ScreenX; + + {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; + Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + + + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; + Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; + + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + + + for S := 1 to 1 do + Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; + + for T := 0 to 1 do + Text[T].X := Text[T].X - 10*ScreenX; + + Result := true; +end; + +procedure TScreenSingModi.Finish; +begin +inherited Finish; + +Winner := DllMan.PluginFinish(PlayerInfo); + +//Log.LogError('Winner: ' + InttoStr(Winner)); + +//DLLMan.UnLoadPlugin; +end; + +function LoadTex (const Name: PChar; Typ: TTextureType): 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(false, PChar(TexName), UTEXTURE.TTextureType(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 +var + Stream: TAudioPlaybackStream; + i: Integer; + Filename: String; +begin + //Search for Sound in already loaded Sounds + Filename := UpperCase(SoundPath + Name); + for i := 0 to High(CustomSounds) do + begin + if (UpperCase(CustomSounds[i].Filename) = Filename) then + begin + Result := i; + Exit; + end; + end; + + Stream := AudioPlayback.OpenSound(SoundPath + String(Name)); + if (Stream = nil) then + begin + Result := 0; + Exit; + end; + + SetLength(CustomSounds, Length(CustomSounds)+1); + CustomSounds[High(CustomSounds)].Stream := Stream; + Result := High(CustomSounds); +end; + +procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound +begin + if (Index <= High(CustomSounds)) then + AudioPlayback.PlaySound(CustomSounds[Index].Stream); +end; + +end. + diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas new file mode 100644 index 00000000..be1320f2 --- /dev/null +++ b/src/screens/UScreenSong.pas @@ -0,0 +1,2019 @@ +unit UScreenSong; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + + +uses + UMenu, + SDL, + UMusic, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + UCommon, + ULog, + UThemes, + UTexture, + ULanguage, + USong, + UIni; + +type + TScreenSong = class(TMenu) + private + EqualizerData: TFFTData; // moved here to avoid stack overflows + EqualizerBands: array of Byte; + EqualizerTime: Cardinal; + + procedure StartMusicPreview(); + procedure StopMusicPreview(); + 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; + MusicPreviewTimer: PSDL_TimerID; + + CoverX: integer; + CoverY: integer; + CoverW: integer; + is_jump: boolean; // Jump to Song Mod + is_jump_title:boolean; //Jump to SOng MOd-YTrue if search for Title + + //Party Mod + Mode: TSingMode; + + //party Statics (Joker) + StaticTeam1Joker1: Cardinal; + StaticTeam1Joker2: Cardinal; + StaticTeam1Joker3: Cardinal; + StaticTeam1Joker4: Cardinal; + StaticTeam1Joker5: Cardinal; + + StaticTeam2Joker1: Cardinal; + StaticTeam2Joker2: Cardinal; + StaticTeam2Joker3: Cardinal; + StaticTeam2Joker4: Cardinal; + StaticTeam2Joker5: Cardinal; + + StaticTeam3Joker1: Cardinal; + StaticTeam3Joker2: Cardinal; + StaticTeam3Joker3: Cardinal; + StaticTeam3Joker4: Cardinal; + StaticTeam3Joker5: Cardinal; + + StaticParty: array of Cardinal; + TextParty: array of Cardinal; + StaticNonParty: array of Cardinal; + TextNonParty: array of Cardinal; + + + constructor Create; override; + procedure SetScroll; + //procedure SetScroll1; + //procedure SetScroll2; + procedure SetScroll3; + procedure SetScroll4; + procedure SetScroll5; + procedure SetScroll6; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure GenerateThumbnails(); + procedure onShow; override; + procedure onHide; override; + procedure SelectNext; + procedure SelectPrev; + //procedure UpdateLCD; //TODO: maybe LCD Support as Plugin? + 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, + gl, + USkins, + UDLLManager, + UParty, + UPlaylist, + UMenuButton, + 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; + Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); + + //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; CharCode: WideChar; PressedDown: Boolean): Boolean; +var + I: integer; + I2: integer; + SDL_ModState: Word; + Letter: WideChar; +begin + Result := true; + + //Song Screen Extensions (Jumpto + Menu) + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseInput(PressedKey, CharCode, PressedDown); + Exit; + end + else if (ScreenSongJumpto.Visible) then + begin + Result := ScreenSongJumpto.ParseInput(PressedKey, CharCode, PressedDown); + Exit; + end; + + if (PressedDown) then + begin // Key Down + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + + //Jump to Artist/Titel + if ((SDL_ModState and KMOD_LALT <> 0) and (Mode = smNormal)) then + begin + if (WideCharUpperCase(CharCode)[1] in ([WideChar('A')..WideChar('Z')]) ) then + begin + Letter := WideCharUpperCase(CharCode)[1]; + 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 + (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + //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 + (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + + //Break and Exit + Exit; + end; + end; + end; + end; + + Exit; + end; + + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + + 'M': //Show SongMenu + begin + if (Songs.SongList.Count > 0) then + begin + if (Mode = smNormal) then + begin + if (not CatSongs.Song[Interaction].Main) then // clicked on Song + begin + 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 + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + Exit; + end; + + 'P': //Show Playlist Menu + begin + if (Songs.SongList.Count > 0) and (Mode = smNormal) then + begin + ScreenSongMenu.MenuShow(SM_Playlist_Load); + end; + Exit; + end; + + 'J': //Show Jumpto Menu + begin + if (Songs.SongList.Count > 0) and (Mode = smNormal) then + begin + ScreenSongJumpto.Visible := True; + end; + Exit; + end; + + 'E': + begin + OpenEditor; + Exit; + end; + + 'R': + begin + if (Songs.SongList.Count > 0) and (Mode = smNormal) then + begin + if (SDL_ModState = KMOD_LSHIFT) and (Ini.Tabs_at_startup = 1) then //Random Category + begin + I2 := 0; //Count Cats + for I:= low(CatSongs.Song) to high (CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + Inc(I2); + end; + + 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 is now the categorie in I2 the song + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Fix: Not Existing Song selected: + //if (I+1=I2) then Inc(I2); + + //Choose Song + SkipTo(I2-I); + end + else //Random in one Category + begin + SkipTo(Random(CatSongs.VisibleSongs)); + end; + AudioPlayback.PlaySound(SoundLib.Change); + + ChangeMusic; + SetScroll4; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + end; + Exit; + end; + end; // normal keys + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + if (Mode = smNormal) then + begin + //On Escape goto Cat-List Hack + if (Ini.Tabs_at_startup = 1) and (CatSongs.CatNumShow <> -1) then + begin + //Find Category + I := Interaction; + while not catsongs.Song[I].Main do + begin + Dec (I); + if (I < low(catsongs.Song)) then + break; + end; + if (I<= 1) then + Interaction := high(catsongs.Song) + else + Interaction := I - 1; + + //Stop Music + StopMusicPreview(); + + 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 + StopMusicPreview(); + AudioPlayback.PlaySound(SoundLib.Back); + + FadeTo(@ScreenMain); + end; + + end; + end + //When in party Mode then Ask before Close + else if (Mode = smPartyMode) then + begin + AudioPlayback.PlaySound(SoundLib.Back); + CheckFadeTo(@ScreenMain,'MSG_END_PARTY'); + end; + end; + SDLK_RETURN: + begin + if Songs.SongList.Count > 0 then + begin + {$IFDEF UseSerialPort} + // PortWriteB($378, 0); + {$ENDIF} + if CatSongs.Song[Interaction].Main then + begin // clicked on Category Button + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + //I := CatSongs.VisibleIndex(Interaction); + CatSongs.ClickCategoryButton(Interaction); + {I2 := CatSongs.VisibleIndex(Interaction); + SongCurrent := SongCurrent - I + I2; + SongTarget := SongTarget - I + I2; } + + // SetScroll4; + + //Show Wrong Song when Tabs on Fix + SelectNext; + FixSelected; + + //Play Music: + ChangeMusic; + end + else + begin // clicked on song + if (Mode = smNormal) then //Normal Mode -> Start Song + begin + //Do the Action that is specified in Ini + case Ini.OnSongClick of + 0: StartSong; + 1: SelectPlayers; + 2:begin + if (CatSongs.CatNumShow = -3) then + ScreenSongMenu.MenuShow(SM_Playlist) + else + ScreenSongMenu.MenuShow(SM_Main); + end; + end; + end + else if (Mode = smPartyMode) then //PartyMode -> Show Menu + begin + if (Ini.PartyPopup = 1) then + ScreenSongMenu.MenuShow(SM_Party_Main) + else + ScreenSong.StartSong; + end; + end; + end; + end; + + SDLK_DOWN: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main do + begin + Inc (I); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (Interaction); + + CatSongs.ClickCategoryButton(Interaction); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + + end; + + // + //Cat Change Hack End} + end; + end; + end; + SDLK_UP: + begin + if (Mode = smNormal) then + begin + //Only Change Cat when not in Playlist or Search Mode + if (CatSongs.CatNumShow > -2) then + begin + //Cat Change Hack + if Ini.Tabs_at_startup = 1 then + begin + I := Interaction; + I2 := 0; + if I <= 0 then I := 1; + + while not catsongs.Song[I].Main or (I2 = 0) do + begin + if catsongs.Song[I].Main then + Inc(I2); + Dec (I); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); + end; + + Interaction := I; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + FixSelected; + + //Play Music: + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + end; + end; + //Cat Change Hack End} + end; + end; + + SDLK_RIGHT: + begin + if (Songs.SongList.Count > 0) and (Mode = smNormal) then + begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectNext; + //InteractNext; + //SongTarget := Interaction; + ChangeMusic; + SetScroll4; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + //Light.LightOne(1, 200); //TODO: maybe Light Support as Plugin? + end; + end; + + SDLK_LEFT: + begin + if (Songs.SongList.Count > 0)and (Mode = smNormal) then + begin + AudioPlayback.PlaySound(SoundLib.Change); + SelectPrev; + ChangeMusic; + SetScroll4; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + //Light.LightOne(0, 200); //TODO: maybe Light Support as Plugin? + end; + end; + + SDLK_1: + begin //Joker // to-do : Party + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin + //Use Joker + Dec(PartySession.Teams.Teaminfo[0].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_2: + begin //Joker + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then + begin + //Use Joker + Dec(PartySession.Teams.Teaminfo[1].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + + SDLK_3: + begin //Joker + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then + begin + //Use Joker + Dec(PartySession.Teams.Teaminfo[2].Joker); + SelectRandomSong; + SetJoker; + end; } + end; + end; + end; +end; + +constructor TScreenSong.Create; +var + i: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Song); + + TextArtist := AddText(Theme.Song.TextArtist); + TextTitle := AddText(Theme.Song.TextTitle); + TextNumber := AddText(Theme.Song.TextNumber); + + //Show Cat in Top Left mod + TextCat := AddText(Theme.Song.TextCat); + StaticCat := AddStatic(Theme.Song.StaticCat); + + //Show Video Icon Mod + VideoIcon := AddStatic(Theme.Song.VideoIcon); + + //Party Mode + StaticTeam1Joker1 := AddStatic(Theme.Song.StaticTeam1Joker1); + StaticTeam1Joker2 := AddStatic(Theme.Song.StaticTeam1Joker2); + StaticTeam1Joker3 := AddStatic(Theme.Song.StaticTeam1Joker3); + StaticTeam1Joker4 := AddStatic(Theme.Song.StaticTeam1Joker4); + StaticTeam1Joker5 := AddStatic(Theme.Song.StaticTeam1Joker5); + + StaticTeam2Joker1 := AddStatic(Theme.Song.StaticTeam2Joker1); + StaticTeam2Joker2 := AddStatic(Theme.Song.StaticTeam2Joker2); + StaticTeam2Joker3 := AddStatic(Theme.Song.StaticTeam2Joker3); + StaticTeam2Joker4 := AddStatic(Theme.Song.StaticTeam2Joker4); + StaticTeam2Joker5 := AddStatic(Theme.Song.StaticTeam2Joker5); + + StaticTeam3Joker1 := AddStatic(Theme.Song.StaticTeam3Joker1); + StaticTeam3Joker2 := AddStatic(Theme.Song.StaticTeam3Joker2); + StaticTeam3Joker3 := AddStatic(Theme.Song.StaticTeam3Joker3); + StaticTeam3Joker4 := AddStatic(Theme.Song.StaticTeam3Joker4); + StaticTeam3Joker5 := AddStatic(Theme.Song.StaticTeam3Joker5); + + //Load Party or NonParty specific Statics and Texts + SetLength(StaticParty, Length(Theme.Song.StaticParty)); + for i := 0 to High(Theme.Song.StaticParty) do + StaticParty[i] := AddStatic(Theme.Song.StaticParty[i]); + + SetLength(TextParty, Length(Theme.Song.TextParty)); + for i := 0 to High(Theme.Song.TextParty) do + TextParty[i] := AddText(Theme.Song.TextParty[i]); + + SetLength(StaticNonParty, Length(Theme.Song.StaticNonParty)); + for i := 0 to High(Theme.Song.StaticNonParty) do + StaticNonParty[i] := AddStatic(Theme.Song.StaticNonParty[i]); + + SetLength(TextNonParty, Length(Theme.Song.TextNonParty)); + for i := 0 to High(Theme.Song.TextNonParty) do + TextNonParty[i] := AddText(Theme.Song.TextNonParty[i]); + + // Song List + //Songs.LoadSongList; // moved to the UltraStar unit + CatSongs.Refresh; + + GenerateThumbnails(); + + + // Randomize Patch + Randomize; + //Equalizer + SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray + For I := low(EqualizerBands) to high(EqualizerBands) do + EqualizerBands[I] := 3; + + if (Length(CatSongs.Song) > 0) then + Interaction := 0; +end; + +procedure TScreenSong.GenerateThumbnails(); +var + I: Integer; + CoverButtonIndex: integer; + CoverButton: TButton; + CoverName: string; + CoverTexture: TTexture; + Cover: TCover; + Song: TSong; +begin + if (Length(CatSongs.Song) <= 0) then + Exit; + + // set length of button array once instead for every song + SetButtonLength(Length(CatSongs.Song)); + + // create all buttons + for I := 0 to High(CatSongs.Song) do + begin + CoverButton := nil; + + // create a clickable cover + CoverButtonIndex := AddButton(300 + I*250, 140, 200, 200, '', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections); + if (CoverButtonIndex > -1) then + CoverButton := Button[CoverButtonIndex]; + if (CoverButton = nil) then + Continue; + + Song := CatSongs.Song[I]; + + // if cover-image is not found then show 'no cover' + if (not FileExists(Song.Path + Song.Cover)) then + Song.Cover := ''; + + if (Song.Cover = '') then + CoverName := Skin.GetTextureFileName('SongCover') + else + CoverName := Song.Path + Song.Cover; + + // load cover and cache its texture + Cover := Covers.FindCover(CoverName); + if (Cover = nil) then + Cover := Covers.AddCover(CoverName); + + // use the cached texture + // TODO: this is a workaround until the new song-loading works. + // The TCover object should be added to the song-object. The thumbnails + // should be loaded each time the song-screen is shown (it is real fast). + // This way, we will not waste that much memory and have a link between + // song and cover. + if (Cover <> nil) then + begin + CoverTexture := Cover.GetPreviewTexture(); + Texture.AddTexture(CoverTexture, TEXTURE_TYPE_PLAIN, true); + CoverButton.Texture := CoverTexture; + end; + + Cover.Free; + end; +end; + +procedure TScreenSong.SetScroll; +var + VS, B: Integer; +begin + VS := CatSongs.VisibleSongs; + if VS > 0 then + begin + // Set Positions + case Theme.Song.Cover.Style of + 3: SetScroll3; + 5:begin + if VS > 5 then + SetScroll5 + else + SetScroll4; + end; + 6: SetScroll6; + else SetScroll4; + end; + + // Set visibility of video icon + Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + + // Set texts + Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; + Text[TextTitle].Text := CatSongs.Song[Interaction].Title; + if (Ini.Tabs_at_startup = 1) and (CatSongs.CatNumShow = -1) then + begin + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].OrderNum) + '/' + IntToStr(CatSongs.CatCount); + Text[TextTitle].Text := '(' + IntToStr(CatSongs.Song[Interaction].CatNumber) + ' ' + Language.Translate('SING_SONGS_IN_CAT') + ')'; + end + else if (CatSongs.CatNumShow = -2) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (CatSongs.CatNumShow = -3) then + Text[TextNumber].Text := IntToStr(CatSongs.VisibleIndex(Interaction)+1) + '/' + IntToStr(VS) + else if (Ini.Tabs_at_startup = 1) then + Text[TextNumber].Text := IntToStr(CatSongs.Song[Interaction].CatNumber) + '/' + IntToStr(CatSongs.Song[Interaction - CatSongs.Song[Interaction].CatNumber].CatNumber) + else + Text[TextNumber].Text := IntToStr(Interaction+1) + '/' + IntToStr(Length(CatSongs.Song)); + end + else + begin + Text[TextNumber].Text := '0/0'; + Text[TextArtist].Text := ''; + Text[TextTitle].Text := ''; + for B := 0 to High(Button) do + Button[B].Visible := False; + + end; +end; + +(* +procedure TScreenSong.SetScroll1; +var + B: integer; // button + //BMin: integer; // button min // Auto Removed, Unused Variable + //BMax: integer; // button max // Auto Removed, Unused Variable + 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; + +(** + * Rotation + *) +procedure TScreenSong.SetScroll4; +var + B: integer; + Angle: real; + Z, Z2: real; + VS: integer; +begin + VS := CatSongs.VisibleSongs(); + + for B := 0 to High(Button) do + begin + Button[B].Visible := CatSongs.Song[B].Visible; + if Button[B].Visible then + begin + // angle between the cover and selected song-cover in radians + Angle := 2*Pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS; + + // calc z-position from angle + Z := (1 + cos(Angle)) / 2; // scaled to range [0..1] + Z2 := (1 + 2*Z) / 3; // scaled to range [1/3..1] + + // adjust cover's width and height according its z-position + // Note: Theme.Song.Cover.W is not used as width and height are equal + // and Theme.Song.Cover.W is used as circle radius in Scroll5. + Button[B].W := Theme.Song.Cover.H * Z2; + Button[B].H := Button[B].W; + + // set cover position + Button[B].X := Theme.Song.Cover.X + + (0.185 * Theme.Song.Cover.H * VS * sin(Angle)) * Z2 - + ((Button[B].H - Theme.Song.Cover.H)/2); + Button[B].Y := Theme.Song.Cover.Y + + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7; + Button[B].Z := Z / 2 + 0.3; + end; + end; +end; + +(** + * rotate + *) +procedure TScreenSong.SetScroll5; +var + B: integer; + Angle: real; + Pos: Real; + VS: integer; + Padding: real; + X: Real; + { + Theme.Song.CoverW: circle radius + Theme.Song.CoverX: x-pos. of the left edge of the selected cover + Theme.Song.CoverY: y-pos. of the upper edge of the selected cover + Theme.Song.CoverH: cover height + } +begin + VS := CatSongs.VisibleSongs(); + + // Update positions of all buttons + for B := 0 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 is the distance to the centered cover in the range [-VS/2..+VS/2] + Pos := (CatSongs.VisibleIndex(B) - SongCurrent); + if (Pos < -VS/2) then + Pos := Pos + VS + else if (Pos > VS/2) then + Pos := Pos - VS; + + // Avoid overlapping of the front covers. + // Use an alternate position for the five front covers. + if (Abs(Pos) < 2.5) then + begin + Angle := Pi * (Pos / 5); // Range: (-1/4*Pi .. +1/4*Pi) + + Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8)); + Button[B].W := Button[B].H; + + //Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + + Padding := (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 - Padding; + Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + Button[B].Z := 0.95 - Abs(Pos) * 0.01; + end + else + begin + // Transform Pos to range [-1..-1/2, +1/2..+1] + if Pos < 0 then + Pos := Pos/VS - 0.5 + else + Pos := Pos/VS + 0.5; + + // angle in radians [-2Pi..-Pi, +Pi..+2Pi] + Angle := 2*Pi * Pos; + + Button[B].H := 0.6*(Theme.Song.Cover.H-Abs(Theme.Song.Cover.H * cos(Angle/2)*0.8)); + Button[B].W := Button[B].H; + + Padding := (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); + Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; + 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].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; + end; + 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; + 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 // 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 + inherited; +{** + * Pause background music, so we can play it again on scorescreen + *} + SoundLib.PauseBgMusic; + + AudioPlayback.Stop; + + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; + if Ini.Players = 4 then PlayersPlay := 6; + + //Cat Mod etc + if (Ini.Tabs_at_startup = 1) and (CatSongs.CatNumShow = -1) then + begin + CatSongs.ShowCategoryList; + FixSelected; + //Show Cat in Top Left Mod + HideCatTL; + end; + + if Length(CatSongs.Song) > 0 then + begin + //Load Music only when Song Preview is activated + if ( Ini.PreviewVolume <> 0 ) then + StartMusicPreview(); + + SetScroll; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? + end; + + //Playlist Mode + if (Mode = smNormal) then + begin + //If Playlist Shown -> Select Next automatically + if (CatSongs.CatNumShow = -3) then + begin + SelectNext; + ChangeMusic; + end; + end + //Party Mode + else if (Mode = smPartyMode) then + begin + SelectRandomSong; + //Show Menu directly in PartyMode + //But only if selected in Options + if (Ini.PartyPopup = 1) then + begin + ScreenSongMenu.MenuShow(SM_Party_Main); + end; + end; + + SetJoker; + SetStatics; +end; + +procedure TScreenSong.onHide; +begin + // turn music volume to 100% + AudioPlayback.SetVolume(1.0); + + // if preview is deactivated: load musicfile now + If (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then + AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + + // if hide then stop music (for party mode popup on exit) + if (Display.NextScreen <> @ScreenSing) and + (Display.NextScreen <> @ScreenSingModi) then + begin + StopMusicPreview(); + end; +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 + // cover fade + if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then + begin + // load new texture + Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); + Button[Interaction].Texture.Alpha := 1; + Button[Interaction].Texture2 := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); + Button[Interaction].Texture2.Alpha := 1; + 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; + + Result := true; +end; + +procedure TScreenSong.SelectNext; +var + Skip: 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 + // show uncached texture + //Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); +end; + +procedure TScreenSong.SelectPrev; +var + Skip: 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; + + // show uncached texture + //Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); + end; +end; + +(* +procedure TScreenSong.UpdateLCD; //TODO: maybe LCD Support as Plugin? +begin + LCD.HideCursor; + LCD.Clear; + LCD.WriteText(1, Text[TextArtist].Text); + LCD.WriteText(2, Text[TextTitle].Text); + +end; +*) + +procedure TScreenSong.StartMusicPreview(); +var + Song: TSong; +begin + AudioPlayback.Close(); + + Song := CatSongs.Song[Interaction]; + if not assigned(Song) then + Exit; + + if AudioPlayback.Open(Song.Path + Song.Mp3) then + begin + AudioPlayback.Position := AudioPlayback.Length / 4; + // set preview volume + if (Ini.PreviewFading = 0) then + begin + // music fade disabled: start with full volume + AudioPlayback.SetVolume(IPreviewVolumeVals[Ini.PreviewVolume]); + AudioPlayback.Play() + end + else + begin + // music fade enabled: start muted and fade-in + AudioPlayback.SetVolume(0); + AudioPlayback.FadeIn(Ini.PreviewFading, IPreviewVolumeVals[Ini.PreviewVolume]); + end; + end; +end; + +procedure TScreenSong.StopMusicPreview(); +begin + // Cancel pending preview requests + SDL_RemoveTimer(MusicPreviewTimer); + + // Stop preview of previous song + AudioPlayback.Stop; +end; + +function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; +var + ScreenSong: TScreenSong; +begin + ScreenSong := TScreenSong(param); + if (ScreenSong <> nil) then + ScreenSong.StartMusicPreview(); + Result := 0; +end; + +// Changes previewed song +procedure TScreenSong.ChangeMusic; +begin + StopMusicPreview(); + + // Preview song if activated and current selection is not a category cover + if (CatSongs.VisibleSongs > 0) and + (not CatSongs.Song[Interaction].Main) and + (Ini.PreviewVolume <> 0) then + begin + // Delay song fading to prevent the song from being played while scrolling + MusicPreviewTimer := SDL_AddTimer(200, MusicPreviewTimerCallback, Self); + end; +end; + +procedure TScreenSong.SkipTo(Target: Cardinal); +var + i: integer; +begin + UnLoadDetailedCover; + + Interaction := High(CatSongs.Song); + SongTarget := 0; + + for i := 1 to Target+1 do + SelectNext; + + FixSelected2; +end; + +procedure TScreenSong.DrawEqualizer; +var + I, J: Integer; + ChansPerBand: byte; // channels per band + MaxChannel: Integer; + CurBand: Integer; // current band + CurTime: Cardinal; + PosX, PosY: Integer; + Pos: Real; +begin + // Nothing to do if no music is played or an equalizer bar consists of no block + if (AudioPlayback.Finished or (Theme.Song.Equalizer.Length <= 0)) then + Exit; + + CurTime := SDL_GetTicks(); + + // Evaluate FFT-data every 44 ms + if (CurTime >= EqualizerTime) then + begin + EqualizerTime := CurTime + 44; + AudioPlayback.GetFFTData(EqualizerData); + + Pos := 0; + // use only the first approx. 92 of 256 FFT-channels (approx. up to 8kHz + ChansPerBand := ceil(92 / Theme.Song.Equalizer.Bands); // How much channels are used for one Band + MaxChannel := ChansPerBand * Theme.Song.Equalizer.Bands - 1; + + // Change Lengths + for i := 0 to MaxChannel do + begin + // Gain higher freq. data so that the bars are visible + if i > 35 then + EqualizerData[i] := EqualizerData[i] * 8 + else if i > 11 then + EqualizerData[i] := EqualizerData[i] * 4.5 + else + EqualizerData[i] := EqualizerData[i] * 1.1; + + // clamp data + if (EqualizerData[i] > 1) then + EqualizerData[i] := 1; + + // Get max. pos + if (EqualizerData[i] * Theme.Song.Equalizer.Length > Pos) then + Pos := EqualizerData[i] * Theme.Song.Equalizer.Length; + + // Check if this is the last channel in the band + if ((i+1) mod ChansPerBand = 0) then + begin + CurBand := i div ChansPerBand; + + // Smooth delay if new equalizer is lower than the old one + if ((EqualizerBands[CurBand] > Pos) and (EqualizerBands[CurBand] > 1)) then + EqualizerBands[CurBand] := EqualizerBands[CurBand] - 1 + else + EqualizerBands[CurBand] := Round(Pos); + + Pos := 0; + end; + end; + + end; + + // Draw equalizer bands + + // Setup OpenGL + glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); + glDisable(GL_TEXTURE_2D); + glEnable(GL_BLEND); + + // Set position of the first equalizer bar + PosY := Theme.Song.Equalizer.Y; + PosX := Theme.Song.Equalizer.X; + + // Draw bars for each band + for I := 0 to High(EqualizerBands) do + begin + // Reset to lower or left position depending on the drawing-direction + if Theme.Song.Equalizer.Direction then // Vertical bars + // FIXME: Is Theme.Song.Equalizer.Y the upper or lower coordinate? + PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length + else // Horizontal bars + PosX := Theme.Song.Equalizer.X; + + // Draw the bar as a stack of blocks + for J := 1 to EqualizerBands[I] do + begin + // Draw block + 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; + + // Calc position of the bar's next block + if Theme.Song.Equalizer.Direction then // Vertical bars + PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space + else // Horizontal bars + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; + end; + + // Calc position of the next bar + if Theme.Song.Equalizer.Direction then // Vertical bars + PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space + else // Horizontal bars + PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; + end; +end; + +procedure TScreenSong.SelectRandomSong; +var + I, I2: Integer; +begin + case PlaylistMan.Mode of + smNormal: //All Songs Just Select Random Song + begin + //When Tabs are activated then use Tab Method + if (Ini.Tabs_at_startup = 1) then + begin + repeat + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + until CatSongs.Song[I2].Main = false; + + //Search Cat + for I := I2 downto low(CatSongs.Song) do + begin + if CatSongs.Song[I].Main then + break; + end; + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat + + //Choose Cat + CatSongs.ShowCategoryList; + + //Show Cat in Top Left Mod + ShowCatTL (I); + + CatSongs.ClickCategoryButton(I); + SelectNext; + + //Choose Song + SkipTo(I2-I); + end + //When Tabs are deactivated use easy Method + else + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPartyMode: //One Category Select Category and Select Random Song + begin + CatSongs.ShowCategoryList; + CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); + ShowCatTL(PlaylistMan.CurPlayList); + + SelectNext; + FixSelected2; + + SkipTo(Random(CatSongs.VisibleSongs)); + end; + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song + begin + PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); + + SkipTo(Random(CatSongs.VisibleSongs)); + FixSelected2; + end; + end; + + AudioPlayback.PlaySound(SoundLib.Change); + ChangeMusic; + SetScroll; + //UpdateLCD; //TODO: maybe LCD Support as Plugin? +end; + +procedure TScreenSong.SetJoker; +begin + // If Party Mode + // to-do : Party + if Mode = smPartyMode then //Show Joker that are available + begin + (* + if (PartySession.Teams.NumTeams >= 1) then + begin + Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); + Static[StaticTeam1Joker2].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 2); + Static[StaticTeam1Joker3].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 3); + Static[StaticTeam1Joker4].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 4); + Static[StaticTeam1Joker5].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 5); + end + else + begin + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 2) then + begin + Static[StaticTeam2Joker1].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 1); + Static[StaticTeam2Joker2].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 2); + Static[StaticTeam2Joker3].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 3); + Static[StaticTeam2Joker4].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 4); + Static[StaticTeam2Joker5].Visible := (PartySession.Teams.Teaminfo[1].Joker >= 5); + end + else + begin + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + end; + + if (PartySession.Teams.NumTeams >= 3) then + begin + Static[StaticTeam3Joker1].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 1); + Static[StaticTeam3Joker2].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 2); + Static[StaticTeam3Joker3].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 3); + Static[StaticTeam3Joker4].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 4); + Static[StaticTeam3Joker5].Visible := (PartySession.Teams.Teaminfo[2].Joker >= 5); + end + else + begin + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; + *) + end + else + begin //Hide all + Static[StaticTeam1Joker1].Visible := False; + Static[StaticTeam1Joker2].Visible := False; + Static[StaticTeam1Joker3].Visible := False; + Static[StaticTeam1Joker4].Visible := False; + Static[StaticTeam1Joker5].Visible := False; + + Static[StaticTeam2Joker1].Visible := False; + Static[StaticTeam2Joker2].Visible := False; + Static[StaticTeam2Joker3].Visible := False; + Static[StaticTeam2Joker4].Visible := False; + Static[StaticTeam2Joker5].Visible := False; + + Static[StaticTeam3Joker1].Visible := False; + Static[StaticTeam3Joker2].Visible := False; + Static[StaticTeam3Joker3].Visible := False; + Static[StaticTeam3Joker4].Visible := False; + Static[StaticTeam3Joker5].Visible := False; + end; +end; + +procedure TScreenSong.SetStatics; +var + I: Integer; + Visible: Boolean; +begin + //Set Visibility of Party Statics and Text + Visible := (Mode = smPartyMode); + + for I := 0 to high(StaticParty) do + Static[StaticParty[I]].Visible := Visible; + + for I := 0 to high(TextParty) do + Text[TextParty[I]].Visible := Visible; + + //Set Visibility of Non Party Statics and Text + Visible := not Visible; + + for I := 0 to high(StaticNonParty) do + Static[StaticNonParty[I]].Visible := Visible; + + for I := 0 to high(TextNonParty) do + Text[TextNonParty[I]].Visible := Visible; +end; + +//Procedures for Menu + +procedure TScreenSong.StartSong; +begin + CatSongs.Selected := Interaction; + StopMusicPreview(); + + //Party Mode + if (Mode = smPartyMode) then + begin + FadeTo(@ScreenSingModi); + end + else + begin + FadeTo(@ScreenSing); + end; +end; + +procedure TScreenSong.SelectPlayers; +begin + CatSongs.Selected := Interaction; + StopMusicPreview(); + + ScreenName.Goto_SingScreen := True; + FadeTo(@ScreenName); +end; + +procedure TScreenSong.OpenEditor; +begin + if (Songs.SongList.Count > 0) and + (not CatSongs.Song[Interaction].Main) and + (Mode = smNormal) then + begin + StopMusicPreview(); + AudioPlayback.PlaySound(SoundLib.Start); + CurrentSong := CatSongs.Song[Interaction]; + FadeTo(@ScreenEditSub); + end; +end; + +//Team No of Team (0-5) +procedure TScreenSong.DoJoker (Team: Byte); +begin + { + if (Mode = smPartyMode) and + (PartySession.Teams.NumTeams >= Team + 1) and + (PartySession.Teams.Teaminfo[Team].Joker > 0) then + begin + //Use Joker + 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; + + // show cached texture + Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, true); + Button[Interaction].Texture2.Alpha := 0; + + if Button[Interaction].Texture.Name <> Skin.GetTextureFileName('SongCover') then + Texture.UnloadTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); +end; + +procedure TScreenSong.Refresh; +begin + { + CatSongs.Refresh; + CatSongs.ShowCategoryList; + Interaction := 0; + SelectNext; + FixSelected; + } +end; + +end. diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas new file mode 100644 index 00000000..89d198cc --- /dev/null +++ b/src/screens/UScreenSongJumpto.pas @@ -0,0 +1,212 @@ +unit UScreenSongJumpto; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + +type + TScreenSongJumpto = class(TMenu) + private + //For ChangeMusic + LastPlayed: Integer; + VisibleBool: Boolean; + public + VisSongs: Integer; + + constructor Create; override; + + //Visible //Whether the Menu should be Drawn + //Whether the Menu should be Drawn + procedure SetVisible(Value: Boolean); + property Visible: Boolean read VisibleBool write SetVisible; + + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + + procedure SetTextFound(const Count: Cardinal); + end; + +var + IType: Array [0..2] of String; + SelectType: Integer; + + +implementation + +uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; + +function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case CharCode of + '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"', + '[', '{', ';', ':': + begin + if Interaction = 0 then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + CharCode; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + end; + + // check special keys + case PressedKey of + SDLK_BACKSPACE: + begin + if (Interaction = 0) AND (Length(Button[0].Text[0].Text) > 0) then + begin + Button[0].Text[0].DeleteLastL; + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + end; + end; + + SDLK_RETURN, + SDLK_ESCAPE: + begin + Visible := False; + AudioPlayback.PlaySound(SoundLib.Back); + if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then + begin + ScreenSong.UnLoadDetailedCover; + Button[0].Text[0].Text := ''; + CatSongs.SetFilter('', 0); + SetTextFound(0); + end; + end; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: + begin + {SelectNext; + Button[0].Text[0].Selected := (Interaction = 0);} + end; + + SDLK_UP: + begin + {SelectPrev; + Button[0].Text[0].Selected := (Interaction = 0); } + end; + + SDLK_RIGHT: + begin + Interaction := 1; + InteractInc; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; + end; + SDLK_LEFT: + begin + Interaction := 1; + InteractDec; + if (Length(Button[0].Text[0].Text) > 0) then + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Interaction := 0; + end; + end; + end; +end; + +constructor TScreenSongJumpto.Create; +//var +// I: integer; // Auto Removed, Unused Variable +begin + inherited Create; + + AddText(Theme.SongJumpto.TextFound); + + LoadFromTheme(Theme.SongJumpto); + + AddButton(Theme.SongJumpto.ButtonSearchText); + if (Length(Button[0].Text) = 0) then + AddButtonText(14, 20, ''); + + SelectType := 0; + AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); + + + Interaction := 0; + LastPlayed := 0; +end; + +procedure TScreenSongJumpto.SetVisible(Value: Boolean); +begin +//If change from unvisible to Visible then OnShow + if (VisibleBool = False) AND (Value = True) then + OnShow; + + VisibleBool := Value; +end; + +procedure TScreenSongJumpto.onShow; +begin + inherited; + + //Reset Screen if no Old Search is Displayed + if (CatSongs.CatNumShow <> -2) then + begin + SelectsS[0].SetSelectOpt(0); + + Button[0].Text[0].Text := ''; + Text[0].Text := Theme.SongJumpto.NoSongsFound; + end; + + //Select Input + Interaction := 0; + Button[0].Text[0].Selected := True; + + LastPlayed := ScreenSong.Interaction; +end; + +function TScreenSongJumpto.Draw: boolean; +begin + Result := inherited Draw; +end; + +procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); +begin + if (Count = 0) then + begin + Text[0].Text := Theme.SongJumpto.NoSongsFound; + if (Length(Button[0].Text[0].Text) = 0) then + ScreenSong.HideCatTL + else + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); + end + else + begin + Text[0].Text := Format(Theme.SongJumpto.SongsFound, [Count]); + + //Set CatTopLeftText + ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); + end; + + + //Set visSongs + VisSongs := Count; + + //Fix SongSelection + ScreenSong.Interaction := high(CatSongs.Song); + ScreenSong.SelectNext; + ScreenSong.FixSelected; + + //Play Correct Music + if (ScreenSong.Interaction <> LastPlayed) then + begin + LastPlayed := ScreenSong.Interaction; + + ScreenSong.ChangeMusic; + end; +end; + +end. diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas new file mode 100644 index 00000000..74e2c3fc --- /dev/null +++ b/src/screens/UScreenSongMenu.pas @@ -0,0 +1,641 @@ +unit UScreenSongMenu; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +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; CharCode: WideChar; 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; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + if (PressedDown) then + begin // Key Down + if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin + // check normal keys + case WideCharUpperCase(CharCode)[1] of + '0'..'9', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"': + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; + exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_BACKSPACE: + begin + Button[Interaction].Text[0].DeleteLastL; + exit; + end; + end; + end; + + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + 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 + //Use Joker + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(0) + end; + end; + end; + SDLK_2: + begin //Jocker + //Use Joker + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(1) + end; + end; + end; + SDLK_3: + begin //Jocker + //Use Joker + case CurMenu of + SM_Party_Main: + begin + ScreenSong.DoJoker(2) + end; + end; + end; + end; // case + end; // if +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 + Result := inherited Draw; +end; + +procedure TScreenSongMenu.onShow; +begin + inherited; + +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'); + // to-do : Party + {Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); + Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); + Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);} + Button[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/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas new file mode 100644 index 00000000..891b108d --- /dev/null +++ b/src/screens/UScreenStatDetail.pas @@ -0,0 +1,270 @@ +unit UScreenStatDetail; + +interface + +{$I switches.inc} + +uses + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + UIni, + UDataBase, + UThemes; + +type + TScreenStatDetail = class(TMenu) + public + Typ: TStatType; + Page: Cardinal; + Count: Byte; + Reversed: Boolean; + + TotEntrys: Cardinal; + TotPages: Cardinal; + + + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetTitle; + Procedure SetPage(NewPage: Cardinal); + end; + +implementation + +uses + UGraphic, + ULanguage, + Math, + Classes, + ULog; + +function TScreenStatDetail.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenStatMain); + end; + SDLK_RETURN: + begin + if Interaction = 0 then begin + //Next Page + SetPage(Page+1); + end; + + if Interaction = 1 then begin + //Previous Page + if (Page > 0) then + SetPage(Page-1); + end; + + if Interaction = 2 then begin + //Reverse Order + Reversed := not Reversed; + SetPage(Page); + end; + + if Interaction = 3 then begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenStatMain); + end; + end; + SDLK_LEFT: + begin + InteractPrev; + end; + SDLK_RIGHT: + begin + InteractNext; + end; + SDLK_UP: + begin + InteractPrev; + end; + SDLK_DOWN: + begin + InteractNext; + end; + end; + end; +end; + +constructor TScreenStatDetail.Create; +var + I: integer; +begin + inherited Create; + + for I := 0 to High(Theme.StatDetail.TextList) do + AddText(Theme.StatDetail.TextList[I]); + + Count := Length(Theme.StatDetail.TextList); + + AddText(Theme.StatDetail.TextDescription); + AddText(Theme.StatDetail.TextPage); + + LoadFromTheme(Theme.StatDetail); + + AddButton(Theme.StatDetail.ButtonNext); + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_NEXT')); + + AddButton(Theme.StatDetail.ButtonPrev); + if (Length(Button[1].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_PREV')); + + AddButton(Theme.StatDetail.ButtonReverse); + if (Length(Button[2].Text)=0) then + AddButtonText(14, 20, Language.Translate('STAT_REVERSE')); + + AddButton(Theme.StatDetail.ButtonExit); + if (Length(Button[3].Text)=0) then + AddButtonText(14, 20, Theme.Options.Description[7]); + + Interaction := 0; + Typ := TStatType(0); +end; + +procedure TScreenStatDetail.onShow; +begin + inherited; + + //Set Tot Entrys and PAges + TotEntrys := DataBase.GetTotalEntrys(Typ); + TotPages := Ceil(TotEntrys / Count); + + //Show correct Title + SetTitle; + + //Show First Page + Reversed := False; + SetPage(0); +end; + +procedure TScreenStatDetail.SetTitle; +begin + if Reversed then + Text[Count].Text := Theme.StatDetail.DescriptionR[Ord(Typ)] + else + Text[Count].Text := Theme.StatDetail.Description[Ord(Typ)]; +end; + +procedure TScreenStatDetail.SetPage(NewPage: Cardinal); +var + StatList: TList; + I: Integer; + FormatStr: String; + PerPage: Byte; +begin + // fetch statistics + StatList := Database.GetStats(Typ, Count, NewPage, Reversed); + if ((StatList <> nil) and (StatList.Count > 0)) then + begin + Page := NewPage; + + // reset texts + for I := 0 to Count-1 do + Text[I].Text := ''; + + FormatStr := Theme.StatDetail.FormatStr[Ord(Typ)]; + + //refresh Texts + for I := 0 to StatList.Count-1 do + begin + try + case Typ of + stBestScores: begin //Best Scores + with TStatResultBestScores(StatList[I]) do + begin + //Set Texts + if (Score > 0) then + begin + Text[I].Text := Format(FormatStr, + [Singer, Score, Theme.ILevel[Difficulty], SongArtist, SongTitle]); + end; + end; + end; + + stBestSingers: begin //Best Singers + with TStatResultBestSingers(StatList[I]) do + begin + //Set Texts + if (AverageScore > 0) then + Text[I].Text := Format(FormatStr, [Player, AverageScore]); + end; + end; + + stMostSungSong: begin //Popular Songs + with TStatResultMostSungSong(StatList[I]) do + begin + //Set Texts + if (Artist <> '') then + Text[I].Text := Format(FormatStr, [Artist, Title, TimesSung]); + end; + end; + + stMostPopBand: begin //Popular Bands + with TStatResultMostPopBand(StatList[I]) do + begin + //Set Texts + if (ArtistName <> '') then + Text[I].Text := Format(FormatStr, [ArtistName, TimesSungtot]); + end; + end; + end; + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString in UScreenStatDetail: ' + E.Message); + end; + end; + + if (Page + 1 = TotPages) and (TotEntrys mod Count <> 0) then + PerPage := (TotEntrys mod Count) + else + PerPage := Count; + + try + Text[Count+1].Text := Format(Theme.StatDetail.PageStr, + [Page + 1, TotPages, PerPage, TotEntrys]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString in UScreenStatDetail: ' + E.Message); + end; + + //Show correct Title + SetTitle; + end; + + Database.FreeStats(StatList); +end; + + +procedure TScreenStatDetail.SetAnimationProgress(Progress: real); +var I: Integer; +begin + for I := 0 to High(Button) do + Button[I].Texture.ScaleW := Progress; +end; + +end. diff --git a/src/screens/UScreenStatMain.pas b/src/screens/UScreenStatMain.pas new file mode 100644 index 00000000..bec9d312 --- /dev/null +++ b/src/screens/UScreenStatMain.pas @@ -0,0 +1,301 @@ +unit UScreenStatMain; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +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; + function FormatOverviewIntro(FormatStr: string): string; + function FormatSongOverview(FormatStr: string): string; + function FormatPlayerOverview(FormatStr: string): string; + public + TextOverview: integer; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + procedure SetAnimationProgress(Progress: real); override; + + procedure SetOverview; + end; + +implementation + +uses UGraphic, + UDataBase, + USongs, + USong, + ULanguage, + UCommon, + Classes, + {$IFDEF win32} + windows, + {$ELSE} + sysconst, + {$ENDIF} + ULog; + +function TScreenStatMain.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then + begin // Key Down + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end; + SDLK_RETURN: + begin + //Exit Button Pressed + if Interaction = 4 then + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenMain); + end + else //One of the Stats Buttons Pressed + begin + AudioPlayback.PlaySound(SoundLib.Back); + ScreenStatDetail.Typ := TStatType(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 Songs.SongList.Count -1 do + if (TSong(Songs.SongList[I]).Video <> '') then + Inc(SongsWithVid); +end; + +procedure TScreenStatMain.onShow; +begin + inherited; + + //Set Overview Text: + SetOverview; +end; + +function TScreenStatMain.FormatOverviewIntro(FormatStr: string): string; +var + Year, Month, Day: Word; +begin + {Format: + %0:d Ultrastar Version + %1:d Day of Reset + %2:d Month of Reset + %3:d Year of Reset} + + Result := ''; + + try + DecodeDate(Database.GetStatReset(), Year, Month, Day); + Result := Format(FormatStr, [Language.Translate('US_VERSION'), Day, Month, Year]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_INTRO": ' + E.Message); + end; +end; + +function TScreenStatMain.FormatSongOverview(FormatStr: string): string; +var + CntSongs, CntSungSongs, CntVidSongs: Integer; + MostPopSongArtist, MostPopSongTitle: String; + StatList: TList; + MostSungSong: TStatResultMostSungSong; +begin + {Format: + %0:d Count Songs + %1:d Count of Sung Songs + %2:d Count of UnSung Songs + %3:d Count of Songs with Video + %4:s Name of the most popular Song} + + CntSongs := Songs.SongList.Count; + CntSungSongs := Database.GetTotalEntrys(stMostSungSong); + CntVidSongs := SongsWithVid; + + StatList := Database.GetStats(stMostSungSong, 1, 0, False); + if ((StatList <> nil) and (StatList.Count > 0)) then + begin + MostSungSong := StatList[0]; + MostPopSongArtist := MostSungSong.Artist; + MostPopSongTitle := MostSungSong.Title; + end + else + begin + MostPopSongArtist := '-'; + MostPopSongTitle := '-'; + end; + Database.FreeStats(StatList); + + Result := ''; + + try + Result := Format(FormatStr, [ + CntSongs, CntSungSongs, CntSongs-CntSungSongs, CntVidSongs, + MostPopSongArtist, MostPopSongTitle]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_SONG": ' + E.Message); + end; +end; + +function TScreenStatMain.FormatPlayerOverview(FormatStr: string): string; +var + CntPlayers: Integer; + BestScoreStat: TStatResultBestScores; + BestSingerStat: TStatResultBestSingers; + BestPlayer, BestScorePlayer: String; + BestPlayerScore, BestScore: Integer; + SingerStats, ScoreStats: TList; +begin + {Format: + %0:d Count Players + %1:s Best Player + %2:d Best Players Score + %3:s Best Score Player + %4:d Best Score} + + CntPlayers := Database.GetTotalEntrys(stBestSingers); + + SingerStats := Database.GetStats(stBestSingers, 1, 0, False); + if ((SingerStats <> nil) and (SingerStats.Count > 0)) then + begin + BestSingerStat := SingerStats[0]; + BestPlayer := BestSingerStat.Player; + BestPlayerScore := BestSingerStat.AverageScore; + end + else + begin + BestPlayer := '-'; + BestPlayerScore := 0; + end; + Database.FreeStats(SingerStats); + + ScoreStats := Database.GetStats(stBestScores, 1, 0, False); + if ((ScoreStats <> nil) and (ScoreStats.Count > 0)) then + begin + BestScoreStat := ScoreStats[0]; + BestScorePlayer := BestScoreStat.Singer; + BestScore := BestScoreStat.Score; + end + else + begin + BestScorePlayer := '-'; + BestScore := 0; + end; + Database.FreeStats(ScoreStats); + + Result := ''; + + try + Result := Format(Formatstr, [ + CntPlayers, BestPlayer, BestPlayerScore, + BestScorePlayer, BestScore]); + except + on E: EConvertError do + Log.LogError('Error Parsing FormatString "STAT_OVERVIEW_PLAYER": ' + E.Message); + end; +end; + +procedure TScreenStatMain.SetOverview; +var + Overview: String; +begin + // Format overview + Overview := FormatOverviewIntro(Language.Translate('STAT_OVERVIEW_INTRO')) + '\n \n' + + FormatSongOverview(Language.Translate('STAT_OVERVIEW_SONG')) + '\n \n' + + FormatPlayerOverview(Language.Translate('STAT_OVERVIEW_PLAYER')); + 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. diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas new file mode 100644 index 00000000..f4be431f --- /dev/null +++ b/src/screens/UScreenTop5.pas @@ -0,0 +1,175 @@ +unit UScreenTop5; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes; + +type + TScreenTop5 = class(TMenu) + public + TextLevel: integer; + TextArtistTitle: integer; + + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + procedure onShow; override; + function Draw: boolean; override; + end; + +implementation + +uses UGraphic, UDataBase, UMain, UIni; + +function TScreenTop5.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + // check normal keys + case WideCharUpperCase(CharCode)[1] of + 'Q': + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE, + SDLK_RETURN: + begin + if (not Fadeout) then begin + FadeTo(@ScreenSong); + Fadeout := true; + end; + end; + SDLK_SYSREQ: + begin + Display.SaveScreenShot; + end; + end; + end; +end; + +constructor TScreenTop5.Create; +var + I: integer; +begin + inherited Create; + + LoadFromTheme(Theme.Top5); + + + TextLevel := AddText(Theme.Top5.TextLevel); + TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); + + for I := 0 to 4 do + StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + +end; + +procedure TScreenTop5.onShow; +var + I: integer; + PMax: integer; +begin + inherited; + + Fadeout := false; + + //ReadScore(CurrentSong); + + PMax := Ini.Players; + if PMax = 4 then PMax := 5; + for I := 0 to PMax do + DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); + + DataBase.WriteScore(CurrentSong); + DataBase.ReadScore(CurrentSong); + + Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; + + for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + + Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); + end; + + for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; +end; + +function TScreenTop5.Draw: boolean; +//var +{ Min: real; + Max: real; + Wsp: real; + Wsp2: real; + Pet: integer;} + +{ Item: integer; + P: integer; + C: integer;} +begin + // Singstar - let it be...... with 6 statics +(* if PlayersPlay = 6 then begin + for Item := 4 to 6 do begin + if ScreenAct = 1 then P := Item-4; + if ScreenAct = 2 then P := Item-1; + + FillPlayer(Item, P); + +{ if ScreenAct = 1 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P1Dark'); + end; + + if ScreenAct = 2 then begin + LoadColor( + Static[StaticBoxLightest[Item]].Texture.ColR, + Static[StaticBoxLightest[Item]].Texture.ColG, + Static[StaticBoxLightest[Item]].Texture.ColB, + 'P4Dark'); + end; } + + end; + end; *) + + Result := inherited Draw; +end; + +end. diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas new file mode 100644 index 00000000..613f3a80 --- /dev/null +++ b/src/screens/UScreenWelcome.pas @@ -0,0 +1,122 @@ +unit UScreenWelcome; + +interface + +{$I switches.inc} + +uses + UMenu, SDL, SysUtils, UThemes; + +type + TScreenWelcome = class(TMenu) + public + Animation: real; + Fadeout: boolean; + constructor Create; override; + function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function Draw: boolean; override; + procedure onShow; override; + end; + +implementation + +uses UGraphic, UTime, USkins, UTexture; + +function TScreenWelcome.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +begin + Result := true; + If (PressedDown) Then begin + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + Result := False; + end; + SDLK_RETURN: + begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + end; + end; +end; + +constructor TScreenWelcome.Create; +begin + inherited Create; + AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt'), TEXTURE_TYPE_TRANSPARENT); + AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); + AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); + Animation := 0; + Fadeout := false; +end; + +procedure TScreenWelcome.onShow; +begin + inherited; + + CountSkipTimeSet; +end; + +function TScreenWelcome.Draw: boolean; +var + Min: real; + Max: real; + Wsp: real; + Pet: integer; +begin + // star animation + Animation := Animation + TimeSkip*1000; + + // draw nothing + Min := 0; Max := 1000; + if (Animation >= Min) and (Animation < Max) then begin + end; + + // popup + Min := 1000; Max := 1120; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.X := 600; + Static[0].Texture.Y := 600 - Wsp * 230; + Static[0].Texture.W := 200; + Static[0].Texture.H := Wsp * 230; + end; + + // bounce + Min := 1120; Max := 1200; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + Static[0].Texture.Y := 370 + Wsp * 50; + Static[0].Texture.H := 230 - Wsp * 50; + end; + + // run + Min := 1500; Max := 3500; + if (Animation >= Min) and (Animation < Max) then begin + Wsp := (Animation - Min) / (Max - Min); + + Static[0].Texture.X := 600 - Wsp * 1400; + Static[0].Texture.H := 180; + + + for Pet := 1 to 5 do begin + Static[Pet].Texture.X := 770 - Wsp * 1400; + Static[Pet].Texture.W := 150 + Wsp * 200; + Static[Pet].Texture.Alpha := Wsp * 0.5; + end; + end; + + Min := 3500; + if (Animation >= Min) and (not Fadeout) then begin + FadeTo(@ScreenMain); + Fadeout := true; + end; + + Result := inherited Draw; +end; + +end. -- cgit v1.2.3 From 1ef212ba89e50965b6b3b2d756be2c17e110b3ee Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 6 Sep 2008 09:53:53 +0000 Subject: Delphi-mode set for FPC git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1348 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 4 ++++ src/screens/UScreenEditHeader.pas | 4 ++++ src/screens/UScreenLevel.pas | 4 ++++ src/screens/UScreenName.pas | 4 ++++ src/screens/UScreenOpen.pas | 4 ++++ src/screens/UScreenOptions.pas | 4 ++++ src/screens/UScreenOptionsAdvanced.pas | 4 ++++ src/screens/UScreenOptionsGame.pas | 4 ++++ src/screens/UScreenOptionsGraphics.pas | 12 +++++++++++- src/screens/UScreenOptionsLyrics.pas | 12 +++++++++++- src/screens/UScreenOptionsThemes.pas | 4 ++++ src/screens/UScreenPartyPlayer.pas | 14 ++++++++++++-- src/screens/UScreenPartyScore.pas | 4 ++++ src/screens/UScreenPartyWin.pas | 4 ++++ src/screens/UScreenPopup.pas | 4 ++++ src/screens/UScreenSongJumpto.pas | 4 ++++ src/screens/UScreenStatDetail.pas | 4 ++++ src/screens/UScreenWelcome.pas | 4 ++++ 18 files changed, 94 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index bf664eb1..b6ed44b1 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -2,6 +2,10 @@ unit UScreenEdit; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UMenu, SDL, UThemes; diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index 28bf7682..3f362304 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -2,6 +2,10 @@ unit UScreenEditHeader; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UMenu, diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index 1ea79e7f..8ecd1bcf 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -2,6 +2,10 @@ unit UScreenLevel; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index f2d59f05..8da46775 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -2,6 +2,10 @@ unit UScreenName; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index 186b9b47..bb197aec 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -2,6 +2,10 @@ unit UScreenOpen; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 24633115..96306df3 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -2,6 +2,10 @@ unit UScreenOptions; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index be8895e1..9460653d 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -2,6 +2,10 @@ unit UScreenOptionsAdvanced; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 2dc8dd7f..3d542b65 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -2,6 +2,10 @@ unit UScreenOptionsGame; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index f2b6faa2..afee44a9 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -2,10 +2,20 @@ unit UScreenOptionsGraphics; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsGraphics = class(TMenu) diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 42f1fadb..d0c60cfa 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -2,10 +2,20 @@ unit UScreenOptionsLyrics; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsLyrics = class(TMenu) diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index a4f00b64..d5beb2d2 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -2,6 +2,10 @@ unit UScreenOptionsThemes; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index fa717677..9d3b0410 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -1,11 +1,21 @@ unit UScreenPartyPlayer; -Interface +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenPartyPlayer = class(TMenu) diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 176a94b2..7c902f26 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -2,6 +2,10 @@ unit UScreenPartyScore; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 002c6f75..3c7f4ea4 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -2,6 +2,10 @@ unit UScreenPartyWin; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index b51fac98..d75dc145 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -2,6 +2,10 @@ unit UScreenPopup; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index 89d198cc..35ec6e56 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -2,6 +2,10 @@ unit UScreenSongJumpto; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 891b108d..00249e9a 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -2,6 +2,10 @@ unit UScreenStatDetail; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas index 613f3a80..6c3fc52f 100644 --- a/src/screens/UScreenWelcome.pas +++ b/src/screens/UScreenWelcome.pas @@ -2,6 +2,10 @@ unit UScreenWelcome; interface +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + {$I switches.inc} uses -- cgit v1.2.3 From 36db9a046b5bb3e60968236a0c24c88e4b18fb82 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 9 Sep 2008 15:58:31 +0000 Subject: ulcd and debug stuff removed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1355 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 83 ----------------------------------------- src/screens/UScreenSingModi.pas | 1 - 2 files changed, 84 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index f7f1fca7..03dc09ed 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -8,7 +8,6 @@ interface {$I switches.inc} - uses UMenu, SDL, @@ -20,8 +19,6 @@ uses UFiles, SysUtils, UThemes, - //ULCD, - //ULight, UGraphicClasses; type @@ -74,9 +71,6 @@ type CRDTS_Stage: TCreditsStages; - myTex: glUint; - mysdlimage,myconvertedsdlimage: PSDL_Surface; - Fadeout: boolean; constructor Create; override; function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; @@ -122,26 +116,6 @@ const 3366, // 20 Ende Credits Tune 60); // 21 start flare im intro - - sdl32bpprgba: TSDL_Pixelformat=(palette: nil; - BitsPerPixel: 32; - BytesPerPixel: 4; - Rloss: 0; - Gloss: 0; - Bloss: 0; - Aloss: 0; - Rshift: 0; - Gshift: 8; - Bshift: 16; - Ashift: 24; - Rmask: $000000ff; - Gmask: $0000ff00; - Bmask: $00ff0000; - Amask: $ff000000; - colorkey: 0; - alpha: 255 ); - - implementation uses @@ -289,48 +263,6 @@ begin // Music.Play; CTime:=0; // setlength(CTime_hold,0); - - mysdlimage:=IMG_Load('test.png'); - if assigned(mysdlimage) then - begin - showmessage('opened image via SDL_Image'+#13#10+ - 'Width: '+inttostr(mysdlimage^.w)+#13#10+ - 'Height: '+inttostr(mysdlimage^.h)+#13#10+ - 'BitsPP: '+inttostr(mysdlimage^.format.BitsPerPixel)+#13#10+ - 'BytesPP: '+inttostr(mysdlimage^.format.BytesPerPixel)+#13#10+ - 'Rloss: '+inttostr(mysdlimage^.format.Rloss)+#13#10+ - 'Gloss: '+inttostr(mysdlimage^.format.Gloss)+#13#10+ - 'Bloss: '+inttostr(mysdlimage^.format.Bloss)+#13#10+ - 'Aloss: '+inttostr(mysdlimage^.format.Aloss)+#13#10+ - 'Rshift: '+inttostr(mysdlimage^.format.Rshift)+#13#10+ - 'Gshift: '+inttostr(mysdlimage^.format.Gshift)+#13#10+ - 'Bshift: '+inttostr(mysdlimage^.format.Bshift)+#13#10+ - 'Ashift: '+inttostr(mysdlimage^.format.Ashift)+#13#10+ - 'Rmask: '+inttohexstr(mysdlimage^.format.Rmask)+#13#10+ - 'Gmask: '+inttohexstr(mysdlimage^.format.Gmask)+#13#10+ - 'Bmask: '+inttohexstr(mysdlimage^.format.Bmask)+#13#10+ - 'Amask: '+inttohexstr(mysdlimage^.format.Amask)+#13#10+ - 'ColKey: '+inttostr(mysdlimage^.format.Colorkey)+#13#10+ - 'Alpha: '+inttostr(mysdlimage^.format.Alpha)); - - if pixfmt_eq(mysdlimage^.format^,sdl32bpprgba) then - showmessage('equal pixelformats') - else - showmessage('different pixelformats'); - - myconvertedsdlimage:=SDL_ConvertSurface(mysdlimage,@sdl32bpprgba,SDL_SWSURFACE); - glGenTextures(1,@myTex); - glBindTexture(GL_TEXTURE_2D, myTex); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); - glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); - glTexImage2D( GL_TEXTURE_2D, 0, 4, myconvertedsdlimage^.w, myconvertedsdlimage^.h, 0, - GL_RGBA, GL_UNSIGNED_BYTE, myconvertedsdlimage^.pixels ); - SDL_FreeSurface(mysdlimage); - SDL_FreeSurface(myconvertedsdlimage); - end - else - showmessage('could not open file - test.png'); - end; procedure TScreenCredits.onHide; @@ -1376,21 +1308,6 @@ Log.LogStatus('',' JB-4'); glPrint (Addr(RuntimeStr[1])); } - - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, myTex); - glbegin(gl_quads); - glTexCoord2f(0,0);glVertex2f(100, 100); - glTexCoord2f(0,1);glVertex2f(100, 200); - glTexCoord2f(1,1); glVertex2f(200, 200); - glTexCoord2f(1,0);glVertex2f(200, 100); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // make the stars shine GoldenRec.Draw; end; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 616ba1c1..8439c0ae 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -24,7 +24,6 @@ uses UMenu, gl, UThemes, - //ULCD, //TODO: maybe LCD Support as Plugin? UScreenSing, ModiSDK; -- cgit v1.2.3 From 8dc13b99b51555be6fa16d271ddb02d995b46d96 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 10 Sep 2008 06:24:16 +0000 Subject: FreeBSD compatibility fixes: - {$IF Defined(Linux)} -> {$IF Defined(Linux) or Defined(BSD)} or {$IF Defined(UNIX)} - config-freebsd.inc added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1357 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGraphics.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index afee44a9..66c46b0f 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -64,9 +64,9 @@ begin // FIXME: changing the video mode does not work this way in windows // and MacOSX as all textures will be invalidated through this. // See the ALT+TAB code too. - {$IFDEF Linux} + {$IF Defined(Linux) or Defined(BSD)} Reinitialize3D(); - {$ENDIF} + {$IFEND} FadeTo(@ScreenOptions); end; end; -- cgit v1.2.3 From b8e1a9b524f0922329c5307b0396f78a3dc2b44f Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 11 Sep 2008 16:05:43 +0000 Subject: Define BSD changed to FreeBSD as Darwin also defines BSD git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1366 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGraphics.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 66c46b0f..e2d72886 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -64,7 +64,7 @@ begin // FIXME: changing the video mode does not work this way in windows // and MacOSX as all textures will be invalidated through this. // See the ALT+TAB code too. - {$IF Defined(Linux) or Defined(BSD)} + {$IF Defined(Linux) or Defined(FreeBSD)} Reinitialize3D(); {$IFEND} FadeTo(@ScreenOptions); -- cgit v1.2.3 From 3b5af758a1ffb8c02c3fad2ef0acbc0c241b3de5 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 12 Sep 2008 13:19:17 +0000 Subject: removed resource.inc git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1371 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 239 +++++++++++++++++++++++------------------ 1 file changed, 133 insertions(+), 106 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 03dc09ed..812d1f78 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -34,33 +34,33 @@ type 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_entry: TTexture; + credits_entry_dx: 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_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; + 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; @@ -82,12 +82,35 @@ type end; const - Funky_Text: AnsiString = + Funky_Text: string = '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,..'; + CRDTS_BG_FILE = 'credits_v5_bg.png'; + CRDTS_OVL_FILE = 'credits_v5_overlay.png'; + CRDTS_blindguard_FILE = 'names_blindguard.png'; + CRDTS_blindy_FILE = 'names_blindy.png'; + CRDTS_canni_FILE = 'names_canni.png'; + CRDTS_commandio_FILE = 'names_commandio.png'; + CRDTS_lazyjoker_FILE = 'names_lazyjoker.png'; + CRDTS_mog_FILE = 'names_mog.png'; + CRDTS_mota_FILE = 'names_mota.png'; + CRDTS_skillmaster_FILE = 'names_skillmaster.png'; + CRDTS_whiteshark_FILE = 'names_whiteshark.png'; + INTRO_L01_FILE = 'intro-l-01.png'; + INTRO_L02_FILE = 'intro-l-02.png'; + INTRO_L03_FILE = 'intro-l-03.png'; + INTRO_L04_FILE = 'intro-l-04.png'; + INTRO_L05_FILE = 'intro-l-05.png'; + INTRO_L06_FILE = 'intro-l-06.png'; + INTRO_L07_FILE = 'intro-l-07.png'; + INTRO_L08_FILE = 'intro-l-08.png'; + INTRO_L09_FILE = 'intro-l-09.png'; + OUTRO_BG_FILE = 'outro-bg.png'; + OUTRO_ESC_FILE = 'outro-esc.png'; + OUTRO_EXD_FILE = 'outro-exit-dark.png'; Timings: array[0..21] of Cardinal=( 20, // 0 Delay vor Start @@ -143,46 +166,51 @@ begin FadeTo(@ScreenMain); AudioPlayback.PlaySound(SoundLib.Back); end; -{ SDLK_SPACE: + { + SDLK_SPACE: begin setlength(CTime_hold,length(CTime_hold)+1); CTime_hold[high(CTime_hold)]:=CTime; end; -} + } end;//esac end; //fi end; constructor TScreenCredits.Create; +var + CreditsPath: string; begin inherited Create; - credits_bg_tex := Texture.LoadTexture(true, 'CRDTS_BG', TEXTURE_TYPE_PLAIN, 0); - credits_bg_ovl := Texture.LoadTexture(true, 'CRDTS_OVL', TEXTURE_TYPE_TRANSPARENT, 0); - - credits_blindguard := Texture.LoadTexture(true, 'CRDTS_blindguard', TEXTURE_TYPE_TRANSPARENT, 0); - credits_blindy := Texture.LoadTexture(true, 'CRDTS_blindy', TEXTURE_TYPE_TRANSPARENT, 0); - credits_canni := Texture.LoadTexture(true, 'CRDTS_canni', TEXTURE_TYPE_TRANSPARENT, 0); - credits_commandio := Texture.LoadTexture(true, 'CRDTS_commandio', TEXTURE_TYPE_TRANSPARENT, 0); - credits_lazyjoker := Texture.LoadTexture(true, 'CRDTS_lazyjoker', TEXTURE_TYPE_TRANSPARENT, 0); - credits_mog := Texture.LoadTexture(true, 'CRDTS_mog', TEXTURE_TYPE_TRANSPARENT, 0); - credits_mota := Texture.LoadTexture(true, 'CRDTS_mota', TEXTURE_TYPE_TRANSPARENT, 0); - credits_skillmaster := Texture.LoadTexture(true, 'CRDTS_skillmaster', TEXTURE_TYPE_TRANSPARENT, 0); - credits_whiteshark := Texture.LoadTexture(true, 'CRDTS_whiteshark', TEXTURE_TYPE_TRANSPARENT, 0); - - intro_layer01 := Texture.LoadTexture(true, 'INTRO_L01', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer02 := Texture.LoadTexture(true, 'INTRO_L02', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer03 := Texture.LoadTexture(true, 'INTRO_L03', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer04 := Texture.LoadTexture(true, 'INTRO_L04', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer05 := Texture.LoadTexture(true, 'INTRO_L05', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer06 := Texture.LoadTexture(true, 'INTRO_L06', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer07 := Texture.LoadTexture(true, 'INTRO_L07', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer08 := Texture.LoadTexture(true, 'INTRO_L08', TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer09 := Texture.LoadTexture(true, 'INTRO_L09', TEXTURE_TYPE_TRANSPARENT, 0); - - outro_bg := Texture.LoadTexture(true, 'OUTRO_BG', TEXTURE_TYPE_PLAIN, 0); - outro_esc := Texture.LoadTexture(true, 'OUTRO_ESC', TEXTURE_TYPE_TRANSPARENT, 0); - outro_exd := Texture.LoadTexture(true, 'OUTRO_EXD', TEXTURE_TYPE_TRANSPARENT, 0); + CreditsPath := ResourcesPath + 'credits/'; + + credits_bg_tex := Texture.LoadTexture(CreditsPath + CRDTS_BG_FILE, TEXTURE_TYPE_PLAIN, 0); + credits_bg_ovl := Texture.LoadTexture(CreditsPath + CRDTS_OVL_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + + credits_blindguard := Texture.LoadTexture(CreditsPath + CRDTS_blindguard_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_blindy := Texture.LoadTexture(CreditsPath + CRDTS_blindy_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_canni := Texture.LoadTexture(CreditsPath + CRDTS_canni_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_commandio := Texture.LoadTexture(CreditsPath + CRDTS_commandio_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_lazyjoker := Texture.LoadTexture(CreditsPath + CRDTS_lazyjoker_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_mog := Texture.LoadTexture(CreditsPath + CRDTS_mog_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_mota := Texture.LoadTexture(CreditsPath + CRDTS_mota_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_skillmaster := Texture.LoadTexture(CreditsPath + CRDTS_skillmaster_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + credits_whiteshark := Texture.LoadTexture(CreditsPath + CRDTS_whiteshark_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + + intro_layer01 := Texture.LoadTexture(CreditsPath + INTRO_L01_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer02 := Texture.LoadTexture(CreditsPath + INTRO_L02_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer03 := Texture.LoadTexture(CreditsPath + INTRO_L03_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer04 := Texture.LoadTexture(CreditsPath + INTRO_L04_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer05 := Texture.LoadTexture(CreditsPath + INTRO_L05_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer06 := Texture.LoadTexture(CreditsPath + INTRO_L06_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer07 := Texture.LoadTexture(CreditsPath + INTRO_L07_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer08 := Texture.LoadTexture(CreditsPath + INTRO_L08_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer09 := Texture.LoadTexture(CreditsPath + INTRO_L09_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + + outro_bg := Texture.LoadTexture(CreditsPath + OUTRO_BG_FILE, TEXTURE_TYPE_PLAIN, 0); + outro_esc := Texture.LoadTexture(CreditsPath + OUTRO_ESC_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + outro_exd := Texture.LoadTexture(CreditsPath + OUTRO_EXD_FILE, TEXTURE_TYPE_TRANSPARENT, 0); CRDTS_Stage:=InitialDelay; end; @@ -258,11 +286,11 @@ begin Credits_X := 580; deluxe_slidein := 0; Credits_Alpha := 0; - //Music.SetLoop(true); Loop looped ned, so ne scheisse - loop loops not, shit - AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); //danke kleinster liebster weeeetüüüüü!! - thank you wetü -// Music.Play; + //Music.SetLoop(true); loop loops not, shit + AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); // thank you wetue + //Music.Play; CTime:=0; -// setlength(CTime_hold,0); + //setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -310,7 +338,7 @@ begin inc(CurrentScrollEnd); end; end; -{ // timing hack + { // timing hack X:=5; SetFontStyle (2); SetFontItalic(False); @@ -321,7 +349,8 @@ begin SetFontPos (500, X); glPrint (Addr(visibleText[0])); X:=X+20; - end;} + end; + } end; procedure Start3D; @@ -342,30 +371,24 @@ end; procedure TScreenCredits.DrawCredits; var -T{*, I*}: Cardinal; // Auto Removed, Unused Variable (I) // Auto Removed, Unused Variable (I) -// X: Real; // Auto Removed, Unused Variable -// Ver: PChar; // Auto Removed, Unused Variable -// RuntimeStr: AnsiString; // Auto Removed, Unused Variable + T: Cardinal; Data: TFFTData; j,k,l:cardinal; -f,g{*, h*}: Real; // Auto Removed, Unused Variable (h) // Auto Removed, Unused Variable (h) + f,g: Real; STime:cardinal; Delay:cardinal; - -// myPixel: longword; // Auto Removed, Unused Variable -// myColor: Cardinal; // Auto Removed, Unused Variable 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)); - +const + myLogoCoords: Array[0..27,0..1] of Cardinal = ( + (39,32),(84,32),(100,16),(125,24), + (154,31),(156,58),(168,32),(203,36), + (258,34),(251,50),(274,93),(294,84), + (232,54),(278,62),(319,34),(336,92), + (347,23),(374,32),(377,58),(361,83), + (385,91),(405,91),(429,35),(423,51), + (450,32),(485,34),(444,91),(486,93) + ); begin //dis does teh muiwk y0r AudioPlayback.GetFFTData(Data); @@ -383,13 +406,11 @@ begin Log.LogStatus('',' JB-2'); if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then begin -// CTime:=Timings[20]; -// CRDTS_Stage:=Outro; - + //CTime:=Timings[20]; + //CRDTS_Stage:=Outro; CRDTS_Stage:=Intro; CTime:=0; AudioPlayback.Play; - end; if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then begin @@ -433,17 +454,17 @@ 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 + //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]); + //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(0.5,0.5,0.5); glScalef(4/3,-1,1); glColor4f(1, 1, 1, 1); @@ -563,13 +584,13 @@ begin // draw scroller Draw_FunkyText; -//######################################################################### -// draw credits names + //######################################################################### + // draw credits names -Log.LogStatus('',' JB-4'); + Log.LogStatus('',' JB-4'); -// BlindGuard (von links oben reindrehen, nach rechts unten rausdrehen) - (rotate in from upper left, rotate out to lower right) + // BlindGuard (rotate in from upper left, rotate out to lower right) STime:=Timings[9]-10; Delay:=Timings[10]-Timings[9]; if CTime > STime then @@ -633,7 +654,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Blindy (zoom von 0 auf volle grösse und drehung, zoom auf doppelte grösse und nach rechts oben schieben) - (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) + // Blindy (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) STime:=Timings[10]-10; Delay:=Timings[11]-Timings[10]+5; if CTime > STime then @@ -703,7 +724,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Canni (von links reinschieben, nach rechts oben rausschieben) - (shift in from left, shift out to upper right) + // Canni (shift in from left, shift out to upper right) STime:=Timings[11]-10; Delay:=Timings[12]-Timings[11]+5; if CTime > STime then @@ -768,7 +789,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Commandio (von unten reinklappen, nach rechts oben rausklappen) - (flip in from down, flip out to upper right) + // Commandio (flip in from down, flip out to upper right) STime:=Timings[12]-10; Delay:=Timings[13]-Timings[12]; if CTime > STime then @@ -835,7 +856,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) + // 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 @@ -882,7 +903,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Mog (von links reinklappen, nach rechts unten rausklappen) - (flip in from right, flip out to lower right) + // Mog (flip in from right, flip out to lower right) STime:=Timings[14]-10; Delay:=Timings[15]-Timings[14]+5; if CTime > STime then @@ -951,7 +972,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Mota (von rechts oben reindrehen, nach links unten rausschieben und verkleinern und dabei drehen) - (rotate in from upper right, shift out to lower left while shrinking and rotateing) + // Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing) STime:=Timings[15]-10; Delay:=Timings[16]-Timings[15]+5; if CTime > STime then @@ -1021,7 +1042,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// Skillmaster (von rechts unten reinschieben, nach rechts oben rausdrehen) - (shift in from lower right, rotate out to upper right) + // Skillmaster (shift in from lower right, rotate out to upper right) STime:=Timings[16]-10; Delay:=Timings[17]-Timings[16]+5; if CTime > STime then @@ -1091,7 +1112,7 @@ Log.LogStatus('',' JB-4'); glPopMatrix; end; -// WhiteShark (von links unten reinklappen, nach rechts oben rausklappen) - (flip in from lower left, flip out to upper right) + // WhiteShark (flip in from lower left, flip out to upper right) STime:=Timings[17]-10; Delay:=Timings[18]-Timings[17]; if CTime > STime then @@ -1167,8 +1188,9 @@ Log.LogStatus('',' JB-4'); Log.LogStatus('',' JB-103'); -// #################################################################### -// do some twinkle stuff (kinda on beat) + // #################################################################### + // do some twinkle stuff (kinda on beat) + if (CTime > Timings[8] ) and (CTime < Timings[19] ) then begin @@ -1196,8 +1218,9 @@ Log.LogStatus('',' JB-4'); end; end; -//################################################# -// draw the rest of the main screen (girl and logo + //################################################# + // 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); @@ -1209,14 +1232,17 @@ Log.LogStatus('',' JB-4'); glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); glTexCoord2f(393/512,0);glVertex2f(800, 0); glEnd; -{ glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); + + { + 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); @@ -1297,16 +1323,17 @@ Log.LogStatus('',' JB-4'); // ... end; -{ // draw credits runtime counter + { + // 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(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; -- cgit v1.2.3 From c1814154c5dc76654aef640353693553a6a38381 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 13 Sep 2008 10:59:55 +0000 Subject: Unload background textures when leaving the sing-screen. Thanks to Hawkear for the patch. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1377 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 911d122e..e20a142d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -79,7 +79,8 @@ type constructor Create; override; procedure onShow; override; procedure onShowFinish; override; - + procedure onHide; override; + function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; function Draw: boolean; override; @@ -612,6 +613,16 @@ begin CountSkipTimeSet; end; +procedure TScreenSing.onHide; +begin + // Unload background texture + if (Tex_Background.TexNum > 0) then + begin + glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); + Tex_Background.TexNum := 0; + end; +end; + function TScreenSing.Draw: boolean; var Min: integer; -- cgit v1.2.3 From a40eb015f8dc43ee087bb8374e67c6a75eb9fbc6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 13 Sep 2008 13:02:27 +0000 Subject: - stop both Video and Visualizer (because of the video-toggle with 'v'-key both could have been active) (See SF-tracker Patch 2078902) - VideoLoaded does not belong to the song state anymore git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1381 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 92 +++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 41 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e20a142d..b8c7612f 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,13 +33,13 @@ type type TScreenSing = class(TMenu) + private + VideoLoaded: boolean; protected Paused: boolean; //Pause Mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public - //TextTime: integer; - // TimeBar fields StaticTimeProgress: integer; TextTimeText: integer; @@ -424,21 +424,23 @@ begin // reset video playback engine, to play video clip... fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; -{** - * == Background == - * We have four types of backgrounds: - * + Blank : Nothing has been set, this is our fallback - * + Picture : Picture has been set, and exists - otherwise we fallback - * + Video : Video has been set, and exists - otherwise we fallback - * + Visualization: + Off : No Visialization - * + WhenNoVideo: Overwrites Blank and Picture - * + On : Overwrites Blank, Picture and Video - *} -{** - * set background to: video - *} - CurrentSong.VideoLoaded := False; - fShowVisualization := False; + + {* + * == Background == + * We have four types of backgrounds: + * + Blank : Nothing has been set, this is our fallback + * + Picture : Picture has been set, and exists - otherwise we fallback + * + Video : Video has been set, and exists - otherwise we fallback + * + Visualization: + Off : No Visialization + * + WhenNoVideo: Overwrites Blank and Picture + * + On : Overwrites Blank, Picture and Video + *} + + {* + * set background to: video + *} + VideoLoaded := False; + fShowVisualization := False; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then @@ -446,15 +448,15 @@ begin fShowVisualization := False; fCurrentVideoPlaybackEngine := VideoPlayback; fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; - CurrentSong.VideoLoaded := True; - fCurrentVideoPlaybackEngine.play; + fCurrentVideoPlaybackEngine.Play; + VideoLoaded := True; end; end; -{** - * set background to: picture - *} - if (CurrentSong.Background <> '') and (CurrentSong.VideoLoaded = False) + {* + * set background to: picture + *} + if (CurrentSong.Background <> '') and (VideoLoaded = False) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then try Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); @@ -464,26 +466,31 @@ begin Tex_Background.TexNum := 0; end else + begin Tex_Background.TexNum := 0; -{** - * set background to: visualization (Overwrites all) - *} + end; + + {* + * set background to: visualization (Overwrites all) + *} if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin fShowVisualization := True; fCurrentVideoPlaybackEngine := Visualization; - fCurrentVideoPlaybackEngine.play; + if (fCurrentVideoPlaybackEngine <> nil) then + fCurrentVideoPlaybackEngine.Play; end; -{** - * set background to: visualization (Videos are still shown) - *} + {* + * set background to: visualization (Videos are still shown) + *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (CurrentSong.VideoLoaded = False)) then + (VideoLoaded = False)) then begin fShowVisualization := True; fCurrentVideoPlaybackEngine := Visualization; - fCurrentVideoPlaybackEngine.play; + if (fCurrentVideoPlaybackEngine <> nil) then + fCurrentVideoPlaybackEngine.Play; end; // prepare lyrics timer @@ -579,8 +586,8 @@ begin end; // case // Initialize lyrics by filling its queue - while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= - High(Lines[0].Line)) do + while (not Lyrics.IsQueueFull) and + (Lyrics.LineCounter <= High(Lines[0].Line)) do begin Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); end; @@ -718,7 +725,7 @@ begin SingDrawBackground; // update and draw movie - if (ShowFinish and (CurrentSong.VideoLoaded or fShowVisualization)) then + if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin if assigned(fCurrentVideoPlaybackEngine) then begin @@ -801,6 +808,15 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); + if (VideoPlayback <> nil) then + VideoPlayback.Close; + + if (Visualization <> nil) then + Visualization.Close; + + // to prevent drawing closed video + VideoLoaded := False; + if (Ini.SavePlayback = 1) then begin Log.BenchmarkStart(0); @@ -811,12 +827,6 @@ begin Log.LogBenchmark('Creating files', 0); end; - if CurrentSong.VideoLoaded then - begin - fCurrentVideoPlaybackEngine.Close; - CurrentSong.VideoLoaded := False; // to prevent drawing closed video - end; - SetFontItalic(False); end; -- cgit v1.2.3 From 20d12d5af15bd364cbec888100de6e18bb89561e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 20 Sep 2008 18:19:37 +0000 Subject: Equalizer class written TRGB methods now in UThemes instead of ULyrics equalizer reflection now available Reading from Reflectionsettings from theme follows on sunday :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1387 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index be1320f2..1b5e4c41 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -24,14 +24,13 @@ uses UTexture, ULanguage, USong, - UIni; + UIni, + UMenuEqualizer; type TScreenSong = class(TMenu) private - EqualizerData: TFFTData; // moved here to avoid stack overflows - EqualizerBands: array of Byte; - EqualizerTime: Cardinal; + Equalizer: Tms_Equalizer; procedure StartMusicPreview(); procedure StopMusicPreview(); @@ -41,7 +40,7 @@ type TextNumber: integer; //Video Icon Mod - VideoIcon: Cardinal; + VideoIcon: Cardinal; TextCat: integer; StaticCat: integer; @@ -777,11 +776,13 @@ begin // Randomize Patch Randomize; - //Equalizer + {//Equalizer SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); //ClearArray For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; + EqualizerBands[I] := 3; } + + Equalizer := Tms_Equalizer.Create(AudioPlayback); if (Length(CatSongs.Song) > 0) then Interaction := 0; @@ -1496,8 +1497,7 @@ begin //Draw Equalizer - if Theme.Song.Equalizer.Visible then - DrawEqualizer; + Equalizer.Draw; DrawExtensions; @@ -1657,16 +1657,16 @@ begin end; procedure TScreenSong.DrawEqualizer; -var +{var I, J: Integer; ChansPerBand: byte; // channels per band MaxChannel: Integer; CurBand: Integer; // current band CurTime: Cardinal; PosX, PosY: Integer; - Pos: Real; + Pos: Real; } begin - // Nothing to do if no music is played or an equalizer bar consists of no block + { // Nothing to do if no music is played or an equalizer bar consists of no block if (AudioPlayback.Finished or (Theme.Song.Equalizer.Length <= 0)) then Exit; @@ -1763,7 +1763,7 @@ begin PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space else // Horizontal bars PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; + end; } end; procedure TScreenSong.SelectRandomSong; -- cgit v1.2.3 From 688182ae4f56aabaf12233f32763274286c5d634 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 21 Sep 2008 11:34:25 +0000 Subject: missing files commited Equalizer now loads reflection settings from theme old equalizer methods removed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1388 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 120 +------------------------------------------- 1 file changed, 1 insertion(+), 119 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 1b5e4c41..f632afe0 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -110,7 +110,6 @@ type 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; @@ -776,13 +775,8 @@ begin // Randomize Patch Randomize; - {//Equalizer - SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); - //ClearArray - For I := low(EqualizerBands) to high(EqualizerBands) do - EqualizerBands[I] := 3; } - Equalizer := Tms_Equalizer.Create(AudioPlayback); + Equalizer := Tms_Equalizer.Create(AudioPlayback, Theme.Song.Equalizer); if (Length(CatSongs.Song) > 0) then Interaction := 0; @@ -1495,8 +1489,6 @@ begin for I := 0 to Length(Text) - 1 do Text[I].Draw; - - //Draw Equalizer Equalizer.Draw; DrawExtensions; @@ -1656,116 +1648,6 @@ begin FixSelected2; end; -procedure TScreenSong.DrawEqualizer; -{var - I, J: Integer; - ChansPerBand: byte; // channels per band - MaxChannel: Integer; - CurBand: Integer; // current band - CurTime: Cardinal; - PosX, PosY: Integer; - Pos: Real; } -begin - { // Nothing to do if no music is played or an equalizer bar consists of no block - if (AudioPlayback.Finished or (Theme.Song.Equalizer.Length <= 0)) then - Exit; - - CurTime := SDL_GetTicks(); - - // Evaluate FFT-data every 44 ms - if (CurTime >= EqualizerTime) then - begin - EqualizerTime := CurTime + 44; - AudioPlayback.GetFFTData(EqualizerData); - - Pos := 0; - // use only the first approx. 92 of 256 FFT-channels (approx. up to 8kHz - ChansPerBand := ceil(92 / Theme.Song.Equalizer.Bands); // How much channels are used for one Band - MaxChannel := ChansPerBand * Theme.Song.Equalizer.Bands - 1; - - // Change Lengths - for i := 0 to MaxChannel do - begin - // Gain higher freq. data so that the bars are visible - if i > 35 then - EqualizerData[i] := EqualizerData[i] * 8 - else if i > 11 then - EqualizerData[i] := EqualizerData[i] * 4.5 - else - EqualizerData[i] := EqualizerData[i] * 1.1; - - // clamp data - if (EqualizerData[i] > 1) then - EqualizerData[i] := 1; - - // Get max. pos - if (EqualizerData[i] * Theme.Song.Equalizer.Length > Pos) then - Pos := EqualizerData[i] * Theme.Song.Equalizer.Length; - - // Check if this is the last channel in the band - if ((i+1) mod ChansPerBand = 0) then - begin - CurBand := i div ChansPerBand; - - // Smooth delay if new equalizer is lower than the old one - if ((EqualizerBands[CurBand] > Pos) and (EqualizerBands[CurBand] > 1)) then - EqualizerBands[CurBand] := EqualizerBands[CurBand] - 1 - else - EqualizerBands[CurBand] := Round(Pos); - - Pos := 0; - end; - end; - - end; - - // Draw equalizer bands - - // Setup OpenGL - glColor4f(Theme.Song.Equalizer.ColR, Theme.Song.Equalizer.ColG, Theme.Song.Equalizer.ColB, Theme.Song.Equalizer.Alpha); - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - // Set position of the first equalizer bar - PosY := Theme.Song.Equalizer.Y; - PosX := Theme.Song.Equalizer.X; - - // Draw bars for each band - for I := 0 to High(EqualizerBands) do - begin - // Reset to lower or left position depending on the drawing-direction - if Theme.Song.Equalizer.Direction then // Vertical bars - // FIXME: Is Theme.Song.Equalizer.Y the upper or lower coordinate? - PosY := Theme.Song.Equalizer.Y //+ (Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space) * Theme.Song.Equalizer.Length - else // Horizontal bars - PosX := Theme.Song.Equalizer.X; - - // Draw the bar as a stack of blocks - for J := 1 to EqualizerBands[I] do - begin - // Draw block - 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; - - // Calc position of the bar's next block - if Theme.Song.Equalizer.Direction then // Vertical bars - PosY := PosY - Theme.Song.Equalizer.H - Theme.Song.Equalizer.Space - else // Horizontal bars - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space; - end; - - // Calc position of the next bar - if Theme.Song.Equalizer.Direction then // Vertical bars - PosX := PosX + Theme.Song.Equalizer.W + Theme.Song.Equalizer.Space - else // Horizontal bars - PosY := PosY + Theme.Song.Equalizer.H + Theme.Song.Equalizer.Space; - end; } -end; - procedure TScreenSong.SelectRandomSong; var I, I2: Integer; -- cgit v1.2.3 From f16756422a5dbb24ce1b751bb9e2bb1de4f19713 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 23 Sep 2008 21:17:50 +0000 Subject: added file headers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1404 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenEdit.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenEditConvert.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenEditHeader.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenEditSub.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenLevel.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenLoading.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenMain.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenName.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOpen.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptions.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsAdvanced.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsGame.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsGraphics.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsLyrics.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsRecord.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsSound.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenOptionsThemes.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPartyNewRound.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPartyOptions.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPartyPlayer.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPartyScore.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPartyWin.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenPopup.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenScore.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenSing.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenSingModi.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenSong.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenSongJumpto.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenSongMenu.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenStatDetail.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenStatMain.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenTop5.pas | 25 +++++++++++++++++++++++++ src/screens/UScreenWelcome.pas | 25 +++++++++++++++++++++++++ 34 files changed, 850 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 812d1f78..197fb076 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenCredits; interface diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index b6ed44b1..f141edee 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenEdit; interface diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index dfde696e..4173fac2 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenEditConvert; interface diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index 3f362304..fdc33f6c 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenEditHeader; interface diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 2d98f6bc..09951e28 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenEditSub; interface diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index 8ecd1bcf..9535f527 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenLevel; interface diff --git a/src/screens/UScreenLoading.pas b/src/screens/UScreenLoading.pas index ee3c6f7f..55737b15 100644 --- a/src/screens/UScreenLoading.pas +++ b/src/screens/UScreenLoading.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenLoading; interface diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 4dbdaaa1..2a2d0613 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenMain; interface diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index 8da46775..dd11b882 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenName; interface diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index bb197aec..ee77f34e 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOpen; interface diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 96306df3..10eba591 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptions; interface diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 9460653d..8960640d 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsAdvanced; interface diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 3d542b65..e634419b 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsGame; interface diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index e2d72886..2e2b4f0e 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsGraphics; interface diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index d0c60cfa..3c39daf1 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsLyrics; interface diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 885f7db5..8670d23f 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsRecord; interface diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 9c602788..80210f63 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsSound; interface diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index d5beb2d2..e9fde523 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenOptionsThemes; interface diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 057344dc..fec6da7a 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPartyNewRound; interface diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index bd05e653..5603502a 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPartyOptions; interface diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index 9d3b0410..ca18bc18 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPartyPlayer; interface diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 7c902f26..a2156876 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPartyScore; interface diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 3c7f4ea4..fb8341c9 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPartyWin; interface diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index d75dc145..92ef7e28 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenPopup; interface diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index ab6c020d..ee94d345 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenScore; interface diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b8c7612f..e280855d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSing; interface diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 8439c0ae..4900753b 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSingModi; interface diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index f632afe0..a4c94e45 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSong; interface diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index 35ec6e56..a8679368 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSongJumpto; interface diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index 74e2c3fc..c536fd2d 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenSongMenu; interface diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 00249e9a..20b89b33 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenStatDetail; interface diff --git a/src/screens/UScreenStatMain.pas b/src/screens/UScreenStatMain.pas index bec9d312..a6f67cab 100644 --- a/src/screens/UScreenStatMain.pas +++ b/src/screens/UScreenStatMain.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenStatMain; interface diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index f4be431f..cf5ee257 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenTop5; interface diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas index 6c3fc52f..6655f023 100644 --- a/src/screens/UScreenWelcome.pas +++ b/src/screens/UScreenWelcome.pas @@ -1,3 +1,28 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + unit UScreenWelcome; interface -- cgit v1.2.3 From e5222f99929e0a893fca4ea0ffe08c3bb90fd5c3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 28 Sep 2008 16:30:08 +0000 Subject: Songclass now reports an error if there is no linebreak in a txt file. Error is written to log. Added detailed error description to ERROR_CORRUPT_SONG Popup. Some translation may be added to this one git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1423 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e280855d..1aa9dcde 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -440,7 +440,10 @@ begin // select new song in party mode if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); + if (Length(CurrentSong.LastError) > 0) then + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError) + else + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? CurrentSong.Path := CatSongs.Song[CatSongs.Selected].Path; Exit; -- cgit v1.2.3 From 5a237b4a0da9b4058e08b0db1a46e4c66277ede4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 28 Sep 2008 19:17:48 +0000 Subject: Fixed effects from last song are drawn in next song, see http://www.assembla.com/spaces/usdx/tickets/23 ClearScores method updated: this fixes that first sentence of song is awful if a song was sung before git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1426 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 1aa9dcde..3eb3742d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -844,6 +844,9 @@ begin // to prevent drawing closed video VideoLoaded := False; + + //Kill all Stars and Effects + GoldenRec.KillAll; if (Ini.SavePlayback = 1) then begin -- cgit v1.2.3 From 90226eb8cd49293af7c893e379a071ba7f9583f5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 5 Oct 2008 16:15:09 +0000 Subject: removed some commented relicts from outdated LCD and Light support. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1434 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenLevel.pas | 3 --- src/screens/UScreenPartyNewRound.pas | 4 ---- src/screens/UScreenPartyOptions.pas | 3 --- src/screens/UScreenPartyScore.pas | 4 ---- src/screens/UScreenPartyWin.pas | 4 ---- src/screens/UScreenSingModi.pas | 1 - src/screens/UScreenSong.pas | 25 +------------------------ 7 files changed, 1 insertion(+), 43 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index 9535f527..a632cf78 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -117,9 +117,6 @@ begin inherited; Interaction := Ini.Difficulty; - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; end; procedure TScreenLevel.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index fec6da7a..3d518eca 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -448,10 +448,6 @@ begin end else Text[TextNextPlayer3].Visible := False; } - - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; end; procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 5603502a..9992fab5 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -290,9 +290,6 @@ begin inherited; Randomize; - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; end; procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index a2156876..bd54d55e 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -312,10 +312,6 @@ begin Static[StaticTeam3BG].Visible := False; Static[StaticTeam3Deco].Visible := False; end; - - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; end; procedure TScreenPartyScore.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index fb8341c9..6b4a55c0 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -277,10 +277,6 @@ begin Static[StaticTeam3BG].Visible := False; Static[StaticTeam3Deco].Visible := False; end; } - - -// LCD.WriteText(1, ' Choose mode: '); -// UpdateLCD; end; procedure TScreenPartyWin.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 4900753b..948dc29c 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -95,7 +95,6 @@ type function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure Finish; override; - //procedure UpdateLCD; //TODO: maybe LCD Support as Plugin? //procedure Pause; //Pause Mod(Toggles Pause) end; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a4c94e45..d0337d30 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -273,7 +273,7 @@ begin //Jump to Artist/Titel if ((SDL_ModState and KMOD_LALT <> 0) and (Mode = smNormal)) then begin - if (WideCharUpperCase(CharCode)[1] in ([WideChar('A')..WideChar('Z')]) ) then + if (WideCharUpperCase(CharCode)[1] in ([WideChar('A')..WideChar('Z'), WideChar('0') .. WideChar('9')]) ) then begin Letter := WideCharUpperCase(CharCode)[1]; I2 := Length(CatSongs.Song); @@ -293,7 +293,6 @@ begin ChangeMusic; SetScroll4; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? //Break and Exit Exit; end; @@ -314,7 +313,6 @@ begin ChangeMusic; SetScroll4; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? //Break and Exit Exit; @@ -457,7 +455,6 @@ begin ChangeMusic; SetScroll4; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? end; Exit; end; @@ -541,9 +538,6 @@ begin begin if Songs.SongList.Count > 0 then begin - {$IFDEF UseSerialPort} - // PortWriteB($378, 0); - {$ENDIF} if CatSongs.Song[Interaction].Main then begin // clicked on Category Button //Show Cat in Top Left Mod @@ -682,8 +676,6 @@ begin //SongTarget := Interaction; ChangeMusic; SetScroll4; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? - //Light.LightOne(1, 200); //TODO: maybe Light Support as Plugin? end; end; @@ -695,8 +687,6 @@ begin SelectPrev; ChangeMusic; SetScroll4; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? - //Light.LightOne(0, 200); //TODO: maybe Light Support as Plugin? end; end; @@ -1383,7 +1373,6 @@ begin StartMusicPreview(); SetScroll; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? end; //Playlist Mode @@ -1584,17 +1573,6 @@ begin end; end; -(* -procedure TScreenSong.UpdateLCD; //TODO: maybe LCD Support as Plugin? -begin - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); - -end; -*) - procedure TScreenSong.StartMusicPreview(); var Song: TSong; @@ -1735,7 +1713,6 @@ begin AudioPlayback.PlaySound(SoundLib.Change); ChangeMusic; SetScroll; - //UpdateLCD; //TODO: maybe LCD Support as Plugin? end; procedure TScreenSong.SetJoker; -- cgit v1.2.3 From 93e52c516659926933b729593885a30550017482 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 5 Oct 2008 17:50:00 +0000 Subject: remove ULCD.pas and ULight.pas + some more cleanup of ULCD routines and {$UNDEF UseSerialPort} git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1435 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index d0337d30..c340be2b 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -127,7 +127,6 @@ type procedure onHide; override; procedure SelectNext; procedure SelectPrev; - //procedure UpdateLCD; //TODO: maybe LCD Support as Plugin? procedure SkipTo(Target: Cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix -- cgit v1.2.3 From 528d8cd40ec3763bb3018da4829803404d1cd04b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 9 Oct 2008 17:57:10 +0000 Subject: Errormessages during songload now translatable German and English translations updated Added four new language strings: ERROR_CORRUPT_SONG_FILE_NOT_FOUND ERROR_CORRUPT_SONG_NO_NOTES ERROR_CORRUPT_SONG_NO_BREAKS ERROR_CORRUPT_SONG_UNKNOWN_IN_LINE git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1443 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 3eb3742d..d0908ff8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -441,7 +441,7 @@ begin if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); if (Length(CurrentSong.LastError) > 0) then - ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG') + '\n' + CurrentSong.LastError) + ScreenPopupError.ShowPopup(Format(Language.Translate(CurrentSong.LastError), [CurrentSong.ErrorLineNo])) else ScreenPopupError.ShowPopup(Language.Translate('ERROR_CORRUPT_SONG')); // FIXME: do we need this? @@ -656,6 +656,8 @@ begin glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); Tex_Background.TexNum := 0; end; + + Background.OnFinish; end; function TScreenSing.Draw: boolean; @@ -669,6 +671,8 @@ var CurLyricsTime: real; begin + Background.Draw; + // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then begin -- cgit v1.2.3 From 9ecbf3bb2d137e2c6f04ab615a34becb4b999abb Mon Sep 17 00:00:00 2001 From: f1fth_freed0m Date: Fri, 10 Oct 2008 14:21:49 +0000 Subject: Fixed Compilation This maybe happed by mistake. whiteshark shoud take a look, its his code git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1444 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d0908ff8..abfee360 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -657,7 +657,7 @@ begin Tex_Background.TexNum := 0; end; - Background.OnFinish; +// Background.OnFinish; end; function TScreenSing.Draw: boolean; @@ -671,7 +671,7 @@ var CurLyricsTime: real; begin - Background.Draw; +// Background.Draw; // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then -- cgit v1.2.3 From 322b798413826681915eca1960f081cbc4dd302c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 13 Oct 2008 14:14:32 +0000 Subject: Abstraction of the menus background 5 different bg types: none(fallback), colored, texture, video, and fade(for overlays) Some sideeffect is 5 mb less memory usage, don't know for which reasons :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1446 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenLoading.pas | 6 ------ src/screens/UScreenOptionsThemes.pas | 2 +- src/screens/UScreenPopup.pas | 27 +++++++++------------------ src/screens/UScreenSong.pas | 13 +++++++++++-- 4 files changed, 21 insertions(+), 27 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenLoading.pas b/src/screens/UScreenLoading.pas index 55737b15..f4a3508a 100644 --- a/src/screens/UScreenLoading.pas +++ b/src/screens/UScreenLoading.pas @@ -47,7 +47,6 @@ type constructor Create; override; procedure onShow; override; function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; - function GetBGTexNum: GLUInt; end; implementation @@ -74,9 +73,4 @@ begin inherited; end; -function TScreenLoading.GetBGTexNum: GLUInt; -begin - Result := Self.BackImg.TexNum; -end; - end. diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index e9fde523..82d7d782 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -194,7 +194,7 @@ begin Display.Draw; SwapBuffers; - freeandnil( self ); + Self.Destroy; end; end. diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index 92ef7e28..4ef93549 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -136,7 +136,9 @@ var begin inherited Create; - AddBackground(Theme.CheckPopup.Background.Tex); + AddText(Theme.CheckPopup.TextCheck); + + LoadFromTheme(Theme.CheckPopup); AddButton(Theme.CheckPopup.Button1); if (Length(Button[0].Text) = 0) then @@ -146,14 +148,6 @@ begin if (Length(Button[1].Text) = 0) then AddButtonText(14, 20, 'Button 2'); - AddText(Theme.CheckPopup.TextCheck); - - for I := 0 to High(Theme.CheckPopup.Static) do - AddStatic(Theme.CheckPopup.Static[I]); - - for I := 0 to High(Theme.CheckPopup.Text) do - AddText(Theme.CheckPopup.Text[I]); - Interaction := 0; end; @@ -179,6 +173,8 @@ begin Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); + + Background.OnShow end; // error popup @@ -223,20 +219,14 @@ var begin inherited Create; - AddBackground(Theme.CheckPopup.Background.Tex); + AddText(Theme.ErrorPopup.TextError); + + LoadFromTheme(Theme.ErrorPopup); AddButton(Theme.ErrorPopup.Button1); if (Length(Button[0].Text) = 0) then AddButtonText(14, 20, 'Button 1'); - AddText(Theme.ErrorPopup.TextError); - - for I := 0 to High(Theme.ErrorPopup.Static) do - AddStatic(Theme.ErrorPopup.Static[I]); - - for I := 0 to High(Theme.ErrorPopup.Text) do - AddText(Theme.ErrorPopup.Text[I]); - Interaction := 0; end; @@ -259,6 +249,7 @@ procedure TScreenPopupError.ShowPopup(msg: String); begin Interaction := 0; //Reset Interaction Visible := True; //Set Visible + Background.OnShow; { //dirty hack... Text[0] is invisible for some strange reason for i:=1 to high(Text) do diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index c340be2b..95ccae83 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -340,17 +340,25 @@ begin if (not CatSongs.Song[Interaction].Main) then // clicked on Song begin if CatSongs.CatNumShow = -3 then - ScreenSongMenu.MenuShow(SM_Playlist) + begin + ScreenSongMenu.onShow; + ScreenSongMenu.MenuShow(SM_Playlist); + end else + begin + ScreenSongMenu.onShow; ScreenSongMenu.MenuShow(SM_Main); + end; end else begin + ScreenSongMenu.onShow; ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end //Party Mode -> Show Party Menu else begin + ScreenSongMenu.onShow; ScreenSongMenu.MenuShow(SM_Party_Main); end; end; @@ -361,7 +369,8 @@ begin begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - ScreenSongMenu.MenuShow(SM_Playlist_Load); + ScreenSongMenu.onShow; + ScreenSongMenu.MenuShow(SM_Playlist_Load); end; Exit; end; -- cgit v1.2.3 From 5b04bb1198e14bf6f142ea9735cee2af8e9c021c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 18 Oct 2008 20:03:10 +0000 Subject: uncommented an accidentally commented line git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1454 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index abfee360..6791e235 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -671,7 +671,7 @@ var CurLyricsTime: real; begin -// Background.Draw; + Background.Draw; // set player names (for 2 screens and only Singstar skin) if ScreenAct = 1 then -- cgit v1.2.3 From f004b6574c5311c743472010beb01a723e0baac5 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 18 Oct 2008 20:16:39 +0000 Subject: just another commented line git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1455 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 6791e235..d0908ff8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -657,7 +657,7 @@ begin Tex_Background.TexNum := 0; end; -// Background.OnFinish; + Background.OnFinish; end; function TScreenSing.Draw: boolean; -- cgit v1.2.3 From 6edda5db659a67a119b3469ad92080e168ed2944 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 11:36:41 +0000 Subject: offscreen rendering removed: - fixes zoom errors - fixes missing lyric lines if window is too small - better text quality - fixes some other errors git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1457 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d0908ff8..1267bab8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -298,7 +298,9 @@ begin //Pausepopup is not visibile at the beginning Static[StaticPausePopup].Visible := False; - Lyrics := TLyricEngine.Create(80, Skin_LyricsT, 640, 12, 80, Skin_LyricsT + 36, 640, 12); + Lyrics := TLyricEngine.Create( + Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, + Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); LyricsSync := TLyricsSyncSource.Create(); end; @@ -550,8 +552,6 @@ begin case Ini.LyricsFont of 0: begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; Lyrics.FontStyle := 0; Lyrics.LineColor_en.R := Skin_FontR; @@ -571,8 +571,6 @@ begin end; 1: begin - Lyrics.UpperLineSize := 14; - Lyrics.LowerLineSize := 14; Lyrics.FontStyle := 2; Lyrics.LineColor_en.R := 0.75; @@ -592,8 +590,6 @@ begin end; 2: begin - Lyrics.UpperLineSize := 12; - Lyrics.LowerLineSize := 12; Lyrics.FontStyle := 3; Lyrics.LineColor_en.R := 0.75; @@ -970,15 +966,6 @@ begin else Lyrics.AddLine(nil); end; - - // AddLine draws the passed line to the back-buffer of the render context - // and copies it into a texture afterwards (offscreen rendering). - // This leaves an in invalidated screen. Calling Draw() makes sure, - // that the back-buffer stores the sing-screen, when the next - // swap between the back- and front-buffer is done (eliminates flickering) - // calling AddLine() right before the regular screen update (Display.Draw) - // would be a better solution. - Draw; end; function TLyricsSyncSource.GetClock(): real; -- cgit v1.2.3 From af9523c588b9440880e2d1bebe0cf79235cc4d59 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 11:45:07 +0000 Subject: - background-type -> enum - some string function-parameters defined const git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1458 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsLyrics.pas | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 3c39daf1..b5228a52 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -109,8 +109,6 @@ begin end; constructor TScreenOptionsLyrics.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; -- cgit v1.2.3 From 2f768387f3849699320229a5b756db78af1207a2 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 16:24:59 +0000 Subject: The size given to TextGL.SetSize() now expresses the size in pixel (formerly it was 1/3 of the pixel-size). For theme and plugin compatibility the following functions multiply the size with 3: - UScreenSingModi.Print - TTheme.ThemeLoadText - TTheme.ThemeLoadSelectSlide TODO: Convert the themes/plugins and remove the "*3" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1459 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 6 ++--- src/screens/UScreenEditConvert.pas | 6 ++--- src/screens/UScreenEditSub.pas | 50 ++++++++++++++++++------------------ src/screens/UScreenOpen.pas | 10 ++++---- src/screens/UScreenOptionsRecord.pas | 2 +- src/screens/UScreenSingModi.pas | 4 ++- 6 files changed, 40 insertions(+), 38 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 197fb076..fca65359 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -329,7 +329,7 @@ var X,Y,A: Real; visibleText: PChar; begin - SetFontSize(10); + SetFontSize(30); //Init ScrollingText if (CTime = Timings[7]) then begin @@ -367,7 +367,7 @@ begin X:=5; SetFontStyle (2); SetFontItalic(False); - SetFontSize(9); + SetFontSize(27); glColor4f(1, 1, 1, 1); for S:=0 to high(CTime_hold) do begin visibleText:=pchar(inttostr(CTime_hold[S])); @@ -1352,7 +1352,7 @@ begin // draw credits runtime counter SetFontStyle (2); SetFontItalic(False); - SetFontSize(9); + SetFontSize(27); 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); diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 4173fac2..9efa1a92 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -558,12 +558,12 @@ begin for Pet := 0 to High(ATrack) do begin if ((ATrack[Pet].Status div 1) and 1) = 1 then begin SetFontPos(25, Y + Pet*YSkip + 10); - SetFontSize(5); + SetFontSize(15); glPrint('N'); end; if ((ATrack[Pet].Status div 2) and 1) = 1 then begin SetFontPos(40, Y + Pet*YSkip + 10); - SetFontSize(5); + SetFontSize(15); glPrint('L'); end; end; @@ -577,7 +577,7 @@ begin for Pet := 0 to High(ATrack) do begin SetFontPos(11, Y + 10 + Pet*YSkip); - SetFontSize(5); + SetFontSize(15); glPrint(pchar(ATrack[Pet].Name)); end; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 09951e28..3eefc680 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1115,30 +1115,30 @@ begin inherited Create; SetLength(Player, 1); - // linijka + // line AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); - AddText(40, 17, 1, 6, 1, 1, 1, 'Line'); - TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0'); + AddText(40, 17, 1, 18, 1, 1, 1, 'Line'); + TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0'); // Note AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); - AddText(242, 17, 1, 6, 1, 1, 1, 'Note'); - TextNote := AddText(320, 14, 1, 8, 0, 0, 0, '0 / 0'); + AddText(242, 17, 1, 18, 1, 1, 1, 'Note'); + TextNote := AddText(320, 14, 1, 24, 0, 0, 0, '0 / 0'); // file info AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); - AddText(180, 65, 0, 8, 0, 0, 0, 'Title:'); - AddText(180, 90, 0, 8, 0, 0, 0, 'Artist:'); - AddText(180, 115, 0, 8, 0, 0, 0, 'Mp3:'); - AddText(180, 140, 0, 8, 0, 0, 0, 'BPM:'); - AddText(180, 165, 0, 8, 0, 0, 0, 'GAP:'); - - TextTitle := AddText(250, 65, 0, 8, 0, 0, 0, 'a'); - TextArtist := AddText(250, 90, 0, 8, 0, 0, 0, 'b'); - TextMp3 := AddText(250, 115, 0, 8, 0, 0, 0, 'c'); - TextBPM := AddText(250, 140, 0, 8, 0, 0, 0, 'd'); - TextGAP := AddText(250, 165, 0, 8, 0, 0, 0, 'e'); + AddText(180, 65, 0, 24, 0, 0, 0, 'Title:'); + AddText(180, 90, 0, 24, 0, 0, 0, 'Artist:'); + AddText(180, 115, 0, 24, 0, 0, 0, 'Mp3:'); + AddText(180, 140, 0, 24, 0, 0, 0, 'BPM:'); + AddText(180, 165, 0, 24, 0, 0, 0, 'GAP:'); + + TextTitle := AddText(250, 65, 0, 24, 0, 0, 0, 'a'); + TextArtist := AddText(250, 90, 0, 24, 0, 0, 0, 'b'); + TextMp3 := AddText(250, 115, 0, 24, 0, 0, 0, 'c'); + TextBPM := AddText(250, 140, 0, 24, 0, 0, 0, 'd'); + TextGAP := AddText(250, 165, 0, 24, 0, 0, 0, 'e'); { AddInteraction(2, TextTitle); AddInteraction(2, TextArtist); @@ -1147,15 +1147,15 @@ begin AddInteraction(2, TextGAP);} // note info - AddText(20, 190, 0, 8, 0, 0, 0, 'Start:'); - AddText(20, 215, 0, 8, 0, 0, 0, 'Duration:'); - AddText(20, 240, 0, 8, 0, 0, 0, 'Tone:'); - AddText(20, 265, 0, 8, 0, 0, 0, 'Text:'); + AddText(20, 190, 0, 24, 0, 0, 0, 'Start:'); + AddText(20, 215, 0, 24, 0, 0, 0, 'Duration:'); + AddText(20, 240, 0, 24, 0, 0, 0, 'Tone:'); + AddText(20, 265, 0, 24, 0, 0, 0, 'Text:'); - TextNStart := AddText(120, 190, 0, 8, 0, 0, 0, 'a'); - TextNLength := AddText(120, 215, 0, 8, 0, 0, 0, 'b'); - TextNTon := AddText(120, 240, 0, 8, 0, 0, 0, 'c'); - TextNText := AddText(120, 265, 0, 8, 0, 0, 0, 'd'); + TextNStart := AddText(120, 190, 0, 24, 0, 0, 0, 'a'); + TextNLength := AddText(120, 215, 0, 24, 0, 0, 0, 'b'); + TextNTon := AddText(120, 240, 0, 24, 0, 0, 0, 'c'); + TextNText := AddText(120, 265, 0, 24, 0, 0, 0, 'd'); // debug TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); @@ -1209,7 +1209,7 @@ begin Lyric.X := 400; Lyric.Y := 500; Lyric.Align := 1; - Lyric.Size := 14; + Lyric.Size := 42; Lyric.ColR := 0; Lyric.ColG := 0; Lyric.ColB := 0; diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index ee77f34e..116fd175 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -145,18 +145,18 @@ begin // linijka { AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); - AddText(35, 17, 1, 6, 1, 1, 1, 'Linijka'); - TextSentence := AddText(120, 14, 1, 8, 0, 0, 0, '0 / 0');} + AddText(35, 17, 1, 18, 1, 1, 1, 'Linijka'); + TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0');} // file list // AddBox(400, 100, 350, 450); -// TextF[0] := AddText(430, 155, 0, 8, 0, 0, 0, 'a'); -// TextF[1] := AddText(430, 180, 0, 8, 0, 0, 0, 'a'); +// TextF[0] := AddText(430, 155, 0, 24, 0, 0, 0, 'a'); +// TextF[1] := AddText(430, 180, 0, 24, 0, 0, 0, 'a'); // file name AddBox(20, 540, 500, 40); - TextN := AddText(50, 548, 0, 8, 0, 0, 0, ConversionFileName); + TextN := AddText(50, 548, 0, 24, 0, 0, 0, ConversionFileName); AddInteraction(iText, TextN); // buttons diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 8670d23f..541400fd 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -723,7 +723,7 @@ begin // initialize font // TODO: what about reflection, italic etc.? - SetFontSize(ToneStringHeight/3); + SetFontSize(ToneStringHeight); // center // Note: for centering let us assume that G#4 has the max. horizontal extent diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 948dc29c..1002b964 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -686,7 +686,9 @@ procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); s begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); - SetFontSize(Size); + // FIXME: FONTSIZE + // used by Hold_The_Line / TeamDuell + SetFontSize(Size * 3); SetFontPos (X, Y); glPrint (PChar(Language.Translate(String(Text)))); end; -- cgit v1.2.3 From 5f6fc708b45e686ea03c5aa78ecdc72237121a4b Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 19 Oct 2008 23:40:26 +0000 Subject: The size given to TextGL.SetSize() now expresses the size in pixel (formerly it was 1/3 of the pixel-size). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1461 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditHeader.pas | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index fdc33f6c..5ff3dde5 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -181,37 +181,37 @@ begin AddBox(80, 60, 640, 550); - AddText(160, 110 + 0*30, 0, 10, 0, 0, 0, 'Title:'); - AddText(160, 110 + 1*30, 0, 10, 0, 0, 0, 'Artist:'); - AddText(160, 110 + 2*30, 0, 10, 0, 0, 0, 'MP3:'); + AddText(160, 110 + 0*30, 0, 30, 0, 0, 0, 'Title:'); + AddText(160, 110 + 1*30, 0, 30, 0, 0, 0, 'Artist:'); + AddText(160, 110 + 2*30, 0, 30, 0, 0, 0, 'MP3:'); - AddText(160, 110 + 4*30, 0, 10, 0, 0, 0, 'Background:'); - AddText(160, 110 + 5*30, 0, 10, 0, 0, 0, 'Video:'); - AddText(160, 110 + 6*30, 0, 10, 0, 0, 0, 'VideoGAP:'); + AddText(160, 110 + 4*30, 0, 30, 0, 0, 0, 'Background:'); + AddText(160, 110 + 5*30, 0, 30, 0, 0, 0, 'Video:'); + AddText(160, 110 + 6*30, 0, 30, 0, 0, 0, 'VideoGAP:'); - AddText(160, 110 + 8*30, 0, 10, 0, 0, 0, 'Relative:'); - AddText(160, 110 + 9*30, 0, 10, 0, 0, 0, 'Resolution:'); - AddText(160, 110 + 10*30, 0, 10, 0, 0, 0, 'NotesGAP:'); + AddText(160, 110 + 8*30, 0, 30, 0, 0, 0, 'Relative:'); + AddText(160, 110 + 9*30, 0, 30, 0, 0, 0, 'Resolution:'); + AddText(160, 110 + 10*30, 0, 30, 0, 0, 0, 'NotesGAP:'); - AddText(160, 110 + 12*30, 0, 10, 0, 0, 0, 'Start:'); - AddText(160, 110 + 13*30, 0, 10, 0, 0, 0, 'GAP:'); - AddText(160, 110 + 14*30, 0, 10, 0, 0, 0, 'BPM:'); + AddText(160, 110 + 12*30, 0, 30, 0, 0, 0, 'Start:'); + AddText(160, 110 + 13*30, 0, 30, 0, 0, 0, 'GAP:'); + AddText(160, 110 + 14*30, 0, 30, 0, 0, 0, 'BPM:'); - TextTitle := AddText(340, 110 + 0*30, 0, 10, 0, 0, 0, ''); - TextArtist := AddText(340, 110 + 1*30, 0, 10, 0, 0, 0, ''); - TextMp3 := AddText(340, 110 + 2*30, 0, 10, 0, 0, 0, ''); + TextTitle := AddText(340, 110 + 0*30, 0, 30, 0, 0, 0, ''); + TextArtist := AddText(340, 110 + 1*30, 0, 30, 0, 0, 0, ''); + TextMp3 := AddText(340, 110 + 2*30, 0, 30, 0, 0, 0, ''); - TextBackground := AddText(340, 110 + 4*30, 0, 10, 0, 0, 0, ''); - TextVideo := AddText(340, 110 + 5*30, 0, 10, 0, 0, 0, ''); - TextVideoGAP := AddText(340, 110 + 6*30, 0, 10, 0, 0, 0, ''); + TextBackground := AddText(340, 110 + 4*30, 0, 30, 0, 0, 0, ''); + TextVideo := AddText(340, 110 + 5*30, 0, 30, 0, 0, 0, ''); + TextVideoGAP := AddText(340, 110 + 6*30, 0, 30, 0, 0, 0, ''); - TextRelative := AddText(340, 110 + 8*30, 0, 10, 0, 0, 0, ''); - TextResolution := AddText(340, 110 + 9*30, 0, 10, 0, 0, 0, ''); - TextNotesGAP := AddText(340, 110 + 10*30, 0, 10, 0, 0, 0, ''); + TextRelative := AddText(340, 110 + 8*30, 0, 30, 0, 0, 0, ''); + TextResolution := AddText(340, 110 + 9*30, 0, 30, 0, 0, 0, ''); + TextNotesGAP := AddText(340, 110 + 10*30, 0, 30, 0, 0, 0, ''); - TextStart := AddText(340, 110 + 12*30, 0, 10, 0, 0, 0, ''); - TextGAP := AddText(340, 110 + 13*30, 0, 10, 0, 0, 0, ''); - TextBPM := AddText(340, 110 + 14*30, 0, 10, 0, 0, 0, ''); + TextStart := AddText(340, 110 + 12*30, 0, 30, 0, 0, 0, ''); + TextGAP := AddText(340, 110 + 13*30, 0, 30, 0, 0, 0, ''); + TextBPM := AddText(340, 110 + 14*30, 0, 30, 0, 0, 0, ''); StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); -- cgit v1.2.3 From 0a6843648a39774531733b65f1bf592f443e61fe Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 25 Oct 2008 10:28:43 +0000 Subject: Music preview is started by the main thread now instead of the SDL timer thread. In the preview function a string is casted to WideString. As the SDL thread does not have a threadvar for an iconv context with FPC on linux (used if cwstring is enabled) the preview crashed formerly. Now we can use cwstring on linux again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1470 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 95ccae83..9fc74aae 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1619,13 +1619,20 @@ begin AudioPlayback.Stop; end; -function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; +procedure StartMusicPreview(data: Pointer); var ScreenSong: TScreenSong; begin - ScreenSong := TScreenSong(param); + ScreenSong := TScreenSong(data); if (ScreenSong <> nil) then ScreenSong.StartMusicPreview(); +end; + +function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; +begin + // delegate execution to main-thread + MainThreadExec(@StartMusicPreview, param); + // stop timer Result := 0; end; -- cgit v1.2.3 From e8a388e32a4563ac9ea0895ca6c7cdf83cf9d3ec Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 28 Oct 2008 18:57:02 +0000 Subject: - glPrint(Pchar) -> glPrint(string) - glPrintLetter removed - font engine handles FT_PIXEL_MODE_MONO as FT_Glyph_To_Bitmap(FT_RENDER_MODE_NORMAL) might return a 1bit/pixel black/white image instead of 8bit/pixel gray shaded one (happened with 16px japanese glyphs of simsun.ttf, latin ones were correct). git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1482 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 63 +++++++++++++++++++++++------------- src/screens/UScreenEditConvert.pas | 2 +- src/screens/UScreenOptionsRecord.pas | 4 +-- src/screens/UScreenSing.pas | 33 ++++--------------- src/screens/UScreenSingModi.pas | 2 +- 5 files changed, 51 insertions(+), 53 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index fca65359..7e85c5d4 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -327,39 +327,56 @@ Procedure TScreenCredits.Draw_FunkyText; var S: Integer; X,Y,A: Real; - visibleText: PChar; + visibleText: string; begin SetFontSize(30); + //Init ScrollingText if (CTime = Timings[7]) then begin //Set Position of Text Credits_X := 600; - CurrentScrollStart:=1; - CurrentScrollEnd:=1; + CurrentScrollStart := 1; + CurrentScrollEnd := 1; end; - if (CTime > Timings[7]) and (CurrentScrollStart < length(Funky_Text)) then + 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; + X := 0; + visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd); + + for S := 1 to length(visibleText) do + begin + Y := abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X, 538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); + + if (Credits_X + X > 32) then + A := 17 + else if (Credits_X + X >= 15) then + A := Credits_X + X - 15 + else + A := 0; + + 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); + glPrint(visibleText[S]); + X := X + glTextWidth(visibleText[S]); 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; + + if (Credits_X < 0) and (CurrentScrollStart < length(Funky_Text)) then + begin + Credits_X := Credits_X + glTextWidth(Funky_Text[CurrentScrollStart]); inc(CurrentScrollStart); end; - visibleText:=pchar(Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd)); - if (Credits_X+glTextWidth(visibleText) < 600) and (CurrentScrollEnd < length(Funky_Text)) then begin + + visibleText := Copy(Funky_Text, CurrentScrollStart, CurrentScrollEnd); + + if (Credits_X + glTextWidth(visibleText) < 600) and + (CurrentScrollEnd < length(Funky_Text)) then + begin inc(CurrentScrollEnd); end; end; @@ -370,9 +387,9 @@ begin SetFontSize(27); glColor4f(1, 1, 1, 1); for S:=0 to high(CTime_hold) do begin - visibleText:=pchar(inttostr(CTime_hold[S])); + visibleText:=inttostr(CTime_hold[S]); SetFontPos (500, X); - glPrint (Addr(visibleText[0])); + glPrint (visibleText[0]); X:=X+20; end; } @@ -1357,7 +1374,7 @@ begin 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])); + glPrint (RuntimeStr[1]); } // make the stars shine diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 9efa1a92..8de2efe4 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -578,7 +578,7 @@ begin for Pet := 0 to High(ATrack) do begin SetFontPos(11, Y + 10 + Pet*YSkip); SetFontSize(15); - glPrint(pchar(ATrack[Pet].Name)); + glPrint(ATrack[Pet].Name); end; for Pet := 0 to High(ATrack) do diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 541400fd..5681035f 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -651,7 +651,7 @@ var x1, y1, x2, y2: single; i: integer; ToneBoxWidth: real; - ToneString: PChar; + ToneString: string; ToneStringWidth, ToneStringHeight: real; ToneStringMaxWidth: real; ToneStringCenterXOffset: real; @@ -718,7 +718,7 @@ begin // draw the name of the tone /////// - ToneString := PChar(PreviewChannel[State.ChannelIndex].ToneString); + ToneString := PreviewChannel[State.ChannelIndex].ToneString; ToneStringHeight := ChannelBarsTotalHeight; // initialize font diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 1267bab8..b6384b79 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -550,9 +550,9 @@ begin // set custom options case Ini.LyricsFont of - 0: + 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := 0; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -564,33 +564,14 @@ begin Lyrics.LineColor_dis.B := 0.4; Lyrics.LineColor_dis.A := 1; - Lyrics.LineColor_act.R := 5 / 256; - Lyrics.LineColor_act.G := 163 / 256; - Lyrics.LineColor_act.B := 210 / 256; + Lyrics.LineColor_act.R := 0.02; + Lyrics.LineColor_act.G := 0.6; + Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1: - begin - Lyrics.FontStyle := 2; - - Lyrics.LineColor_en.R := 0.75; - Lyrics.LineColor_en.G := 0.75; - Lyrics.LineColor_en.B := 1; - Lyrics.LineColor_en.A := 1; - - Lyrics.LineColor_dis.R := 0.8; - Lyrics.LineColor_dis.G := 0.8; - Lyrics.LineColor_dis.B := 0.8; - Lyrics.LineColor_dis.A := 1; - - Lyrics.LineColor_act.R := 0.5; - Lyrics.LineColor_act.G := 0.5; - Lyrics.LineColor_act.B := 1; - Lyrics.LineColor_act.A := 1; - end; - 2: + 1, 2: // outline fonts (is TScalableOutlineFont) begin - Lyrics.FontStyle := 3; + Lyrics.FontStyle := Ini.LyricsFont + 1; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 1002b964..c4d4723f 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -690,7 +690,7 @@ begin // used by Hold_The_Line / TeamDuell SetFontSize(Size * 3); SetFontPos (X, Y); - glPrint (PChar(Language.Translate(String(Text)))); + glPrint (Language.Translate(String(Text))); end; function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound -- cgit v1.2.3 From 6585afce2ccd8e7c5ccb3bb3599d4723b00a0433 Mon Sep 17 00:00:00 2001 From: tobigun Date: Tue, 28 Oct 2008 20:16:05 +0000 Subject: some compiler warnings/hints removed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1485 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditConvert.pas | 2 -- src/screens/UScreenEditSub.pas | 18 +++++++----------- src/screens/UScreenOptionsRecord.pas | 1 - src/screens/UScreenOptionsThemes.pas | 2 -- src/screens/UScreenPartyNewRound.pas | 4 +--- src/screens/UScreenPartyOptions.pas | 2 -- src/screens/UScreenPartyPlayer.pas | 1 - src/screens/UScreenPopup.pas | 4 ---- src/screens/UScreenSing.pas | 9 --------- src/screens/UScreenSongMenu.pas | 2 -- 10 files changed, 8 insertions(+), 37 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 8de2efe4..8cc6c59d 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -127,8 +127,6 @@ uses UGraphic, USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; -var - T: integer; begin Result := true; If (PressedDown) Then diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 3eefc680..167d94b4 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -93,7 +93,6 @@ type Lyric: TEditorLyrics; - procedure NewBeat; procedure DivideBPM; procedure MultiplyBPM; procedure LyricsCapitalize; @@ -669,14 +668,15 @@ begin end; end; +{ procedure TScreenEditSub.NewBeat; begin - // click -{ for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNut do - if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = Czas.AktBeat) then begin - // old} -// Music.PlayClick; + // click + for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNut do + if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = Czas.AktBeat) then + Music.PlayClick; end; +} procedure TScreenEditSub.DivideBPM; var @@ -713,7 +713,7 @@ end; procedure TScreenEditSub.LyricsCapitalize; var C: integer; - N: integer; // temporary + //N: integer; // temporary S: string; begin // temporary @@ -925,7 +925,6 @@ procedure TScreenEditSub.DeleteNote; var C: integer; N: integer; - NLen: integer; begin C := Lines[0].Current; @@ -1230,9 +1229,6 @@ end; function TScreenEditSub.Draw: boolean; var - Min: integer; - Sec: integer; - Tekst: string; Pet: integer; AktBeat: integer; begin diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 5681035f..b622f56c 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -739,7 +739,6 @@ end; function TScreenOptionsRecord.Draw: boolean; var - i: integer; Device: TAudioInputDevice; DeviceCfg: PInputDeviceConfig; SelectSlide: TSelectSlide; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 82d7d782..ec6fe014 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -154,8 +154,6 @@ begin end; constructor TScreenOptionsThemes.Create; -var - I: integer; begin inherited Create; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 3d518eca..01de9df7 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -153,8 +153,6 @@ begin end; constructor TScreenPartyNewRound.Create; -var - I: integer; begin inherited Create; @@ -217,7 +215,7 @@ var function GetTeamPlayers(const Num: Byte): String; var Players: Array of String; - J: Byte; + //J: Byte; begin // to-do : Party if (Num-1 >= {PartySession.Teams.NumTeams}0) then exit; diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 9992fab5..fafae0e0 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -199,8 +199,6 @@ begin end; constructor TScreenPartyOptions.Create; -var - I: integer; begin inherited Create; //Fill IPlaylist diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index ca18bc18..d38a6435 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -75,7 +75,6 @@ uses UGraphic, UMain, UIni, UTexture, UParty; function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; var -{*I, *}J: integer; // Auto Removed, Unused Variable (I) SDL_ModState: Word; procedure IntNext; begin diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index 4ef93549..bf4752b9 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -131,8 +131,6 @@ begin end; constructor TScreenPopupCheck.Create; -var - I: integer; begin inherited Create; @@ -214,8 +212,6 @@ begin end; constructor TScreenPopupError.Create; -var - I: integer; begin inherited Create; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b6384b79..5783366d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -249,9 +249,6 @@ end; //Pause Mod End constructor TScreenSing.Create; -var - I: integer; - P: integer; begin inherited Create; @@ -314,7 +311,6 @@ var V2R: boolean; V2M: boolean; V3R: boolean; - NR: TRecR; //Some enlightment of who, how and what this is here please Color: TRGB; success: boolean; @@ -641,9 +637,6 @@ function TScreenSing.Draw: boolean; var Min: integer; Sec: integer; - Tekst: string; - Flash: real; - S: integer; T: integer; CurLyricsTime: real; begin @@ -931,8 +924,6 @@ end; // Called on sentence change // SentenceIndex: index of the new active sentence procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); -var - LyricEngine: TLyricEngine; begin //GoldenStarsTwinkle GoldenRec.SentenceChange; diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index c536fd2d..7aa2e498 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -187,8 +187,6 @@ begin end; constructor TScreenSongMenu.Create; -var - I: integer; begin inherited Create; -- cgit v1.2.3 From 746427f3779275441ee62393fb695a9182703e94 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 2 Nov 2008 21:15:36 +0000 Subject: VideoGap fixed (Tracker Item #2138228) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1496 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5783366d..d49ecc7c 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -731,7 +731,7 @@ begin begin if assigned(fCurrentVideoPlaybackEngine) then begin - fCurrentVideoPlaybackEngine.GetFrame(LyricsState.GetCurrentTime()); + fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; -- cgit v1.2.3 From d33f56a40d9e8325a2782f90bb253dece5127c5f Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 3 Nov 2008 14:53:17 +0000 Subject: All comments are English now (Polish ones have been translated) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1498 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 2 - src/screens/UScreenEditConvert.pas | 48 ++++++++--------- src/screens/UScreenEditHeader.pas | 9 ++-- src/screens/UScreenEditSub.pas | 4 -- src/screens/UScreenOpen.pas | 6 +-- src/screens/UScreenSingModi.pas | 102 ++++++++++++++++++------------------- src/screens/UScreenSong.pas | 42 +++++++-------- src/screens/UScreenTop5.pas | 7 ++- src/screens/UScreenWelcome.pas | 28 +++++----- 9 files changed, 118 insertions(+), 130 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index f141edee..caeaac11 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -136,8 +136,6 @@ end; var Min: integer; Sec: integer; - Tekst: string; - Pet: integer; AktBeat: integer; begin end; diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 8cc6c59d..97a4bf2c 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -328,7 +328,7 @@ begin Lines.Line[C].HighNote := -1; for Nu := 0 to High(Note) do begin - if Note[Nu].NewSentence then begin // nowa linijka + if Note[Nu].NewSentence then begin // new line SetLength(Lines.Line, Length(Lines.Line)+1); Lines.Number := Lines.Number + 1; Lines.High := Lines.High + 1; @@ -359,10 +359,10 @@ begin end; end; - // tworzy miejsce na nowa nute + // create space for new note SetLength(Lines.Line[C].Note, Length(Lines.Line[C].Note)+1); - // dopisuje + // initialize note Lines.Line[C].Note[N].Start := Note[Nu].Start; Lines.Line[C].Note[N].Length := Note[Nu].Len; Lines.Line[C].Note[N].Tone := Note[Nu].Tone; @@ -526,8 +526,8 @@ end; function TScreenEditConvert.Draw: boolean; var - Pet: integer; - Pet2: integer; + Count: integer; + Count2: integer; Bottom: real; X: real; Y: real; @@ -549,18 +549,18 @@ begin DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); // selected - now me use Status System - for Pet := 0 to High(ATrack) do - if ATrack[Pet].Hear then - DrawQuad(10, Y+Pet*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + for Count := 0 to High(ATrack) do + if ATrack[Count].Hear then + DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); - for Pet := 0 to High(ATrack) do begin - if ((ATrack[Pet].Status div 1) and 1) = 1 then begin - SetFontPos(25, Y + Pet*YSkip + 10); + for Count := 0 to High(ATrack) do begin + if ((ATrack[Count].Status div 1) and 1) = 1 then begin + SetFontPos(25, Y + Count*YSkip + 10); SetFontSize(15); glPrint('N'); end; - if ((ATrack[Pet].Status div 2) and 1) = 1 then begin - SetFontPos(40, Y + Pet*YSkip + 10); + if ((ATrack[Count].Status div 2) and 1) = 1 then begin + SetFontPos(40, Y + Count*YSkip + 10); SetFontSize(15); glPrint('L'); end; @@ -570,21 +570,21 @@ begin DrawLine(60, Y, 60, Bottom, 0, 0, 0); DrawLine(790, Y, 790, Bottom, 0, 0, 0); - for Pet := 0 to Length(ATrack) do - DrawLine(10, Y+Pet*YSkip, 790, Y+Pet*YSkip, 0, 0, 0); + for Count := 0 to Length(ATrack) do + DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0); - for Pet := 0 to High(ATrack) do begin - SetFontPos(11, Y + 10 + Pet*YSkip); + for Count := 0 to High(ATrack) do begin + SetFontPos(11, Y + 10 + Count*YSkip); SetFontSize(15); - glPrint(ATrack[Pet].Name); + glPrint(ATrack[Count].Name); end; - for Pet := 0 to High(ATrack) do - for Pet2 := 0 to High(ATrack[Pet].Note) do begin - if ATrack[Pet].Note[Pet2].EventType = 9 then - DrawQuad(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + (Pet+1)*YSkip - ATrack[Pet].Note[Pet2].Data1*35/127, 3, 3, ColR[Pet], ColG[Pet], ColB[Pet]); - if ATrack[Pet].Note[Pet2].EventType = 15 then - DrawLine(60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + 0.75 * YSkip + Pet*YSkip, 60 + ATrack[Pet].Note[Pet2].Start/Len * 725, Y + YSkip + Pet*YSkip, ColR[Pet], ColG[Pet], ColB[Pet]); + for Count := 0 to High(ATrack) do + for Count2 := 0 to High(ATrack[Count].Note) do begin + if ATrack[Count].Note[Count2].EventType = 9 then + DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]); + if ATrack[Count].Note[Count2].EventType = 15 then + DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]); end; // playing line diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index 5ff3dde5..3678973e 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -275,8 +275,7 @@ end; var Min: integer; Sec: integer; - Tekst: string; - Pet: integer; + Count: integer; AktBeat: integer; begin { glClearColor(1,1,1,1); @@ -294,8 +293,8 @@ begin AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then begin - for Pet := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Pet].Start = AktBeat) then begin + for Count := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Count].Start = AktBeat) then begin Music.PlayClick; LastClick := AktBeat; end; @@ -314,7 +313,7 @@ begin Text[TextNStart].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Start); Text[TextNDlugosc].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Dlugosc); Text[TextNTon].Text := IntToStr(Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Ton); - Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Tekst; + Text[TextNText].Text := Czesci[0].Czesc[Czesci[0].Akt].Nuta[AktNuta].Text; // draw static menu inherited Draw; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 167d94b4..963d50de 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -434,10 +434,6 @@ begin begin end; - SDLK_LCTRL: - begin - end; - SDLK_DELETE: begin if SDL_ModState = KMOD_LCTRL then begin diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index 116fd175..989e2ff9 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -143,9 +143,9 @@ constructor TScreenOpen.Create; begin inherited Create; - // linijka + // line { AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); - AddText(35, 17, 1, 18, 1, 1, 1, 'Linijka'); + AddText(35, 17, 1, 18, 1, 1, 1, 'line'); TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0');} // file list @@ -186,8 +186,6 @@ end; var Min: integer; Sec: integer; - Tekst: string; - Pet: integer; AktBeat: integer; begin diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index c4d4723f..892bfe6a 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -180,7 +180,7 @@ begin Result.Sentence[I].Note[J].Start := Lines.Line[I].Note[J].Start; Result.Sentence[I].Note[J].Length := Lines.Line[I].Note[J].Length; Result.Sentence[I].Note[J].Tone := Lines.Line[I].Note[J].Tone; - //Result.Sentence[I].Note[J].Text := Lines.Line[I].Note[J].Tekst; + //Result.Sentence[I].Note[J].Text := Lines.Line[I].Note[J].Text; Result.Sentence[I].Note[J].FreeStyle := (Lines.Line[I].Note[J].NoteType = ntFreestyle); end; end; @@ -299,7 +299,7 @@ function TScreenSingModi.Draw: boolean; var Min: integer; Sec: integer; - Tekst: string; + TextStr: string; S, I: integer; T: integer; CurLyricsTime: real; @@ -445,82 +445,82 @@ begin // .. and scores {if PlayersPlay = 1 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1Score].Text := Tekst; + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1Score].Text := TextStr; end; if PlayersPlay = 2 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; end; if PlayersPlay = 3 then begin - Tekst := IntToStr(Player[0].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; 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; + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; end; if ScreenAct = 2 then begin - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1TwoPScore].Text := Tekst; + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2RScore].Text := Tekst; + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; 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; + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; - Tekst := IntToStr(Player[1].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; - Tekst := IntToStr(Player[2].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; end; if ScreenAct = 2 then begin - Tekst := IntToStr(Player[3].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP1ThreePScore].Text := Tekst; + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; - Tekst := IntToStr(Player[4].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP2MScore].Text := Tekst; + TextStr := IntToStr(Player[4].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; - Tekst := IntToStr(Player[5].ScoreTotalI); - while Length(Tekst) < 5 do Tekst := '0' + Tekst; - Text[TextP3RScore].Text := Tekst; + TextStr := IntToStr(Player[5].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; end; end; } @@ -553,9 +553,7 @@ begin if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then SingDrawBackground; - // comment by blindy: wo zum henker wird denn in diesem screen ein video abgespielt? // update and draw movie - // wie wo wadd? also in der selben funktion in der uscreensing kommt des video in der zeile 995, oder was wollteste wissen? :X { if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 9fc74aae..6aa8e955 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1059,10 +1059,10 @@ end; procedure TScreenSong.SetScroll2; var B: integer; - //Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - //Wsp2: real; + //Factor: integer; // factor of position relative to center of screen + //Factor2: real; begin - // liniowe + // line for B := 0 to High(Button) do Button[B].X := 300 + (B - Interaction) * 260; @@ -1074,12 +1074,12 @@ begin Button[0].X := 300 + 260; end; - // kolowe + // circle { 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); + Factor := (B - Interaction); // 0 to center, -1: to left, +1 to right + Factor2 := Factor / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Factor2); //Button[B].Y := 140 + 50 * ; end; } @@ -1089,12 +1089,12 @@ end; procedure TScreenSong.SetScroll3; // with slide var B: integer; - //Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - //Wsp2: real; + //Factor: integer; // factor of position relative to center of screen + //Factor2: real; begin SongTarget := Interaction; - // liniowe + // line for B := 0 to High(Button) do begin Button[B].X := 300 + (B - SongCurrent) * 260; @@ -1114,12 +1114,12 @@ begin end; } - // kolowe + // circle { 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); + Factor := (B - Interaction); // 0 to center, -1: to left, +1 to right + Factor2 := Factor / Length(Button); + Button[B].X := 300 + 10000 * sin(2*pi*Factor2); //Button[B].Y := 140 + 50 * ; end; } @@ -1253,25 +1253,25 @@ var VS: integer; diff: real; X: Real; - Wsp: real; + Factor: real; Z, Z2: real; begin VS := CatSongs.VisibleSongs; if VS <= 5 then begin - // kolowe + // circle for B := 0 to High(Button) do begin - Button[B].Visible := CatSongs.Song[B].Visible; // nowe + Button[B].Visible := CatSongs.Song[B].Visible; if Button[B].Visible then begin // 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 + Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Wsp)) / 2; + Z := (1 + cos(Factor)) / 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].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * 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; @@ -1547,7 +1547,7 @@ begin end; - // Interaction -> Button, ktorego okladke przeczytamy + // Interaction -> Button, load cover // show uncached texture //Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); end; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index cf5ee257..59f5972b 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -159,11 +159,10 @@ function TScreenTop5.Draw: boolean; //var { Min: real; Max: real; - Wsp: real; - Wsp2: real; - Pet: integer;} + Factor: real; + Factor2: real; -{ Item: integer; + Item: integer; P: integer; C: integer;} begin diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas index 6655f023..485ebedb 100644 --- a/src/screens/UScreenWelcome.pas +++ b/src/screens/UScreenWelcome.pas @@ -94,8 +94,8 @@ function TScreenWelcome.Draw: boolean; var Min: real; Max: real; - Wsp: real; - Pet: integer; + Factor: real; + Count: integer; begin // star animation Animation := Animation + TimeSkip*1000; @@ -108,34 +108,34 @@ begin // popup Min := 1000; Max := 1120; if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); + Factor := (Animation - Min) / (Max - Min); Static[0].Texture.X := 600; - Static[0].Texture.Y := 600 - Wsp * 230; + Static[0].Texture.Y := 600 - Factor * 230; Static[0].Texture.W := 200; - Static[0].Texture.H := Wsp * 230; + Static[0].Texture.H := Factor * 230; end; // bounce Min := 1120; Max := 1200; if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); - Static[0].Texture.Y := 370 + Wsp * 50; - Static[0].Texture.H := 230 - Wsp * 50; + Factor := (Animation - Min) / (Max - Min); + Static[0].Texture.Y := 370 + Factor * 50; + Static[0].Texture.H := 230 - Factor * 50; end; // run Min := 1500; Max := 3500; if (Animation >= Min) and (Animation < Max) then begin - Wsp := (Animation - Min) / (Max - Min); + Factor := (Animation - Min) / (Max - Min); - Static[0].Texture.X := 600 - Wsp * 1400; + Static[0].Texture.X := 600 - Factor * 1400; Static[0].Texture.H := 180; - for Pet := 1 to 5 do begin - Static[Pet].Texture.X := 770 - Wsp * 1400; - Static[Pet].Texture.W := 150 + Wsp * 200; - Static[Pet].Texture.Alpha := Wsp * 0.5; + for Count := 1 to 5 do begin + Static[Count].Texture.X := 770 - Factor * 1400; + Static[Count].Texture.W := 150 + Factor * 200; + Static[Count].Texture.Alpha := Factor * 0.5; end; end; -- cgit v1.2.3 From 912d54923bd0180374b353688fed6ad4ddf41168 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 6 Nov 2008 18:03:11 +0000 Subject: nicer format, no code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1506 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenPartyOptions.pas | 131 +++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 56 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index fafae0e0..d6839778 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -34,52 +34,69 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenPartyOptions = class(TMenu) public - SelectLevel: Cardinal; - SelectPlayList: Cardinal; - SelectPlayList2: Cardinal; - SelectRounds: Cardinal; - SelectTeams: Cardinal; - SelectPlayers1: Cardinal; - SelectPlayers2: Cardinal; - SelectPlayers3: Cardinal; - - PlayList: Integer; - PlayList2: Integer; - Rounds: Integer; - NumTeams: Integer; - NumPlayer1, NumPlayer2, NumPlayer3: Integer; - + SelectLevel: cardinal; + SelectPlayList: cardinal; + SelectPlayList2: cardinal; + SelectRounds: cardinal; + SelectTeams: cardinal; + SelectPlayers1: cardinal; + SelectPlayers2: cardinal; + SelectPlayers3: cardinal; + + PlayList: integer; + PlayList2: integer; + Rounds: integer; + NumTeams: integer; + NumPlayer1, NumPlayer2, NumPlayer3: integer; + constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetPlaylist2; end; var - IPlaylist: array[0..2] of String; - IPlaylist2: array of String; -const - ITeams: array[0..1] of String =('2', '3'); - IPlayers: array[0..3] of String =('1', '2', '3', '4'); - IRounds: array[0..5] of String = ('2', '3', '4', '5', '6', '7'); + IPlaylist: array[0..2] of string; + IPlaylist2: array of string; -implementation + const + ITeams: array[0..1] of string = ('2', '3'); + IPlayers: array[0..3] of string = ('1', '2', '3', '4'); + IRounds: array[0..5] of string = ('2', '3', '4', '5', '6', '7'); -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USong, UDLLManager, UPlaylist, USongs; +implementation -function TScreenPartyOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; - var - I, J: Integer; - OnlyMultiPlayer: boolean; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + USong, + UDLLManager, + UPlaylist, + USongs; + +function TScreenPartyOptions.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +var + I, J: integer; + OnlyMultiPlayer: boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -102,14 +119,16 @@ begin SDLK_RETURN: begin //Don'T start when Playlist is Selected and there are no Playlists - If (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then + if (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then Exit; // Don't start when SinglePlayer Teams but only Multiplayer Plugins available - OnlyMultiPlayer:=true; - for I := 0 to High(DLLMan.Plugins) do begin - OnlyMultiPlayer := (OnlyMultiPlayer AND DLLMan.Plugins[I].TeamModeOnly); + OnlyMultiPlayer := true; + for I := 0 to High(DLLMan.Plugins) do + begin + OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly); end; - if (OnlyMultiPlayer) AND ((NumPlayer1 = 0) OR (NumPlayer2 = 0) OR ((NumPlayer3 = 0) AND (NumTeams = 1))) then begin + if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then + begin ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); Exit; end; @@ -126,12 +145,12 @@ begin //Save Playlist PlaylistMan.Mode := TSingMode( Playlist ); - PlaylistMan.CurPlayList := High(Cardinal); - //If Category Selected Search Category ID + PlaylistMan.CurPlayList := High(cardinal); + //if Category Selected Search Category ID if Playlist = 1 then begin J := -1; - For I := 0 to high(CatSongs.Song) do + for I := 0 to high(CatSongs.Song) do begin if CatSongs.Song[I].Main then Inc(J); @@ -144,7 +163,7 @@ begin end; //No Categorys or Invalid Entry - If PlaylistMan.CurPlayList = High(Cardinal) then + if PlaylistMan.CurPlayList = High(cardinal) then Exit; end else @@ -170,11 +189,11 @@ begin InteractInc; //Change Playlist2 if Playlist is Changed - If (Interaction = 1) then + if (Interaction = 1) then begin SetPlaylist2; end //Change Team3 Players visibility - Else If (Interaction = 4) then + else if (Interaction = 4) then begin SelectsS[7].Visible := (NumTeams = 1); end; @@ -185,11 +204,11 @@ begin InteractDec; //Change Playlist2 if Playlist is Changed - If (Interaction = 1) then + if (Interaction = 1) then begin SetPlaylist2; end //Change Team3 Players visibility - Else If (Interaction = 4) then + else if (Interaction = 4) then begin SelectsS[7].Visible := (NumTeams = 1); end; @@ -222,25 +241,25 @@ begin //Load Screen From Theme LoadFromTheme(Theme.PartyOptions); - SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); + SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); - SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); - SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); - SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); - SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); - SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); + SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); + SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); + SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); + SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); + SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); Interaction := 0; //Hide Team3 Players - SelectsS[7].Visible := False; + SelectsS[7].Visible := false; end; procedure TScreenPartyOptions.SetPlaylist2; -var I: Integer; +var I: integer; begin - Case Playlist of + case Playlist of 0: begin SetLength(IPlaylist2, 1); @@ -249,16 +268,16 @@ begin 1: begin SetLength(IPlaylist2, 0); - For I := 0 to high(CatSongs.Song) do + for I := 0 to high(CatSongs.Song) do begin - If (CatSongs.Song[I].Main) then + if (CatSongs.Song[I].Main) then begin SetLength(IPlaylist2, Length(IPlaylist2) + 1); IPlaylist2[high(IPlaylist2)] := CatSongs.Song[I].Artist; end; end; - If (Length(IPlaylist2) = 0) then + if (Length(IPlaylist2) = 0) then begin SetLength(IPlaylist2, 1); IPlaylist2[0] := 'No Categories found'; -- cgit v1.2.3 From b3229dec9bba8cc1c6f6223720d34975b3e45ae6 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 15 Nov 2008 17:45:06 +0000 Subject: Formatting git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1521 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOpen.pas | 75 ++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 28 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index 989e2ff9..c4d773e7 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -33,40 +33,61 @@ interface {$I switches.inc} -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, - ULyrics, Math, gl, UThemes; +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + UMenuText, + ULyrics, + Math, + gl, + UThemes; type TScreenOpen = class(TMenu) private - TextF: array[0..1] of integer; - TextN: integer; + TextF: array[0..1] of integer; + TextN: integer; public - Tex_Background: TTexture; - FadeOut: boolean; - Path: string; - BackScreen: pointer; + Tex_Background: TTexture; + FadeOut: boolean; + Path: string; + BackScreen: pointer; procedure AddBox(X, Y, W, H: real); constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; // function Draw: boolean; override; // procedure Finish; end; implementation -uses UGraphic, UDraw, UMain, USkins; -function TScreenOpen.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UDraw, + UMain, + USkins; + +function TScreenOpen.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then begin // Key Down + if (PressedDown) then // Key Down + begin // check normal keys case CharCode of '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '.', ':', '\': begin - if Interaction = 0 then begin + if Interaction = 0 then + begin Text[TextN].Text := Text[TextN].Text + CharCode; end; end; @@ -80,24 +101,24 @@ begin end; 8: // del begin - if Interaction = 0 then - begin - Text[TextN].DeleteLastL; - end; + if Interaction = 0 then + begin + Text[TextN].DeleteLastL; + end; end; - - SDLK_ESCAPE : + SDLK_ESCAPE: begin //Empty Filename and go to last Screen - ConversionFileName := ''; - AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + ConversionFileName := ''; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(BackScreen); end; SDLK_RETURN: begin - if (Interaction = 2) then begin + if (Interaction = 2) then + begin //Update Filename and go to last Screen ConversionFileName := Text[TextN].Text; AudioPlayback.PlaySound(SoundLib.Back); @@ -172,7 +193,6 @@ begin AddButton(670, 540, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(30, 5, 0, 0, 0, 'OK'); - end; procedure TScreenOpen.onShow; @@ -184,9 +204,9 @@ end; (*function TScreenEditSub.Draw: boolean; var - Min: integer; - Sec: integer; - AktBeat: integer; + Min: integer; + Sec: integer; + AktBeat: integer; begin end; @@ -197,4 +217,3 @@ begin end;*) end. - -- cgit v1.2.3 From 11e32904087548fffc85053642b7c8d2b8fa5bad Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 24 Nov 2008 21:17:39 +0000 Subject: switch on again saving, when leaving option menus with ESC git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1523 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptions.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 10eba591..10785b86 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -73,7 +73,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin -// Ini.Save; + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); end; -- cgit v1.2.3 From d73dd340314b2d23ac569ffa1a66532beba1b74f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 25 Nov 2008 13:16:18 +0000 Subject: formatting git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1525 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 265 ++++++++++++++++++++++++++--------------- 1 file changed, 169 insertions(+), 96 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 963d50de..949dffae 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -57,7 +57,7 @@ type TScreenEditSub = class(TMenu) private //Variable is True if no Song is loaded - Error: Boolean; + Error: boolean; TextNote: integer; TextSentence: integer; @@ -111,14 +111,14 @@ type procedure CopySentence(Src, Dst: integer); procedure CopySentences(Src, Dst, Num: integer); //Note Name Mod - function GetNoteName(Note: Integer): String; + function GetNoteName(Note: integer): string; public Tex_Background: TTexture; FadeOut: boolean; constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; - function ParseInputEditText(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInputEditText(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; function Draw: boolean; override; procedure onHide; override; end; @@ -134,22 +134,25 @@ uses // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenEditSub.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var SDL_ModState: Word; R: real; begin Result := true; - if TextEditMode then begin + if TextEditMode then + begin Result := ParseInputEditText(PressedKey, CharCode, PressedDown); - end else begin + end + else + begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); - If (PressedDown) then begin // Key Down - // check normal keys + if (PressedDown) then // Key Down + begin // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin @@ -201,14 +204,16 @@ begin 'V': begin // Paste text - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL then + begin if Lines[0].Line[Lines[0].Current].HighNote >= Lines[0].Line[CopySrc].HighNote then PasteText else Log.LogStatus('PasteText: invalid range', 'TScreenEditSub.ParseInput'); end; - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then + begin CopySentence(CopySrc, Lines[0].Current); end; end; @@ -327,20 +332,23 @@ begin SDLK_4: begin - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); CopySentence(CopySrc+3, Lines[0].Current+3); end; - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then + begin CopySentences(CopySrc, Lines[0].Current, 4); end; end; SDLK_5: begin - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); @@ -348,7 +356,8 @@ begin CopySentence(CopySrc+4, Lines[0].Current+4); end; - if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then begin + if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then + begin CopySentences(CopySrc, Lines[0].Current, 5); end; end; @@ -390,19 +399,22 @@ begin SDLK_SLASH: begin - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin // Insert start of sentece if CurrentNote > 0 then DivideSentence; end; - if SDL_ModState = KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LSHIFT then + begin // Join next sentence with current - if Lines[0].Current < Lines[0].High then + if Lines[0].Current < Lines[0].High then JoinSentence; end; - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL then + begin // divide note DivideNote; end; @@ -436,7 +448,8 @@ begin SDLK_DELETE: begin - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL then + begin // moves text to right in current sentence DeleteNote; end; @@ -451,29 +464,36 @@ begin SDLK_RIGHT: begin // right - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); - if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + right - if SDL_ModState = KMOD_LCTRL then begin - if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + if SDL_ModState = KMOD_LCTRL then + begin + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - if CurrentNote = 0 then begin + if CurrentNote = 0 then + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; end; end; // shift + right - if SDL_ModState = KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LSHIFT then + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - if CurrentNote = 0 then begin + if CurrentNote = 0 then + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then @@ -481,14 +501,16 @@ begin end; // alt + right - if SDL_ModState = KMOD_LALT then begin + if SDL_ModState = KMOD_LALT then + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Inc(Lines[0].Line[Lines[0].Current].End_); end; // alt + ctrl + shift + right = move all from cursor to right - if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then + begin MoveAllToEnd(1); end; @@ -497,29 +519,35 @@ begin SDLK_LEFT: begin // left - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); - if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + if CurrentNote = -1 then + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + left - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL the + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); - if CurrentNote = 0 then begin + if CurrentNote = 0 then + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; end; // shift + left - if SDL_ModState = KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LSHIFT then + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); // resizing sentences - if CurrentNote = 0 then begin + if CurrentNote = 0 then + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; @@ -529,8 +557,10 @@ begin end; // alt + left - if SDL_ModState = KMOD_LALT then begin - if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin + if SDL_ModState = KMOD_LALT then + begin + if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Dec(Lines[0].Line[Lines[0].Current].End_); @@ -538,7 +568,8 @@ begin end; // alt + ctrl + shift + right = move all from cursor to left - if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then begin + if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then + begin MoveAllToEnd(-1); end; @@ -548,7 +579,8 @@ begin begin // skip to next sentence - if SDL_ModState = 0 then begin {$IFDEF UseMIDIPort} + if SDL_ModState = 0 then + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; {$endif} @@ -566,7 +598,8 @@ begin end; // decrease tone - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL then + begin TransposeNote(-1); end; @@ -576,7 +609,8 @@ begin begin // skip to previous sentence - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; @@ -585,7 +619,8 @@ begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(Lines[0].Current); CurrentNote := 0; - if Lines[0].Current = -1 then Lines[0].Current := Lines[0].High; + if Lines[0].Current = -1 then + Lines[0].Current := Lines[0].High; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -595,7 +630,8 @@ begin end; // increase tone - if SDL_ModState = KMOD_LCTRL then begin + if SDL_ModState = KMOD_LCTRL then + begin TransposeNote(1); end; end; @@ -605,7 +641,7 @@ begin end; // if end; -function TScreenEditSub.ParseInputEditText(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var SDL_ModState: Word; begin @@ -615,7 +651,7 @@ begin SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); - If (PressedDown) Then + if (PressedDown) then begin // Key Down case PressedKey of @@ -641,10 +677,12 @@ begin SDLK_RIGHT: begin // right - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); - if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; + if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -652,10 +690,12 @@ begin SDLK_LEFT: begin // left - if SDL_ModState = 0 then begin + if SDL_ModState = 0 then + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); - if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + if CurrentNote = -1 then + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -680,11 +720,12 @@ var N: integer; begin CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM / 2; - for C := 0 to Lines[0].High do begin - Lines[0].Line[C].Start := Lines[0].Line[C].Start div 2; - Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; + for C := 0 to Lines[0].High do + begin + Lines[0].Line[C].Start := Lines[0].Line[C].Start div 2; + Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; for N := 0 to Lines[0].Line[C].HighNote do begin - Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; + Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; Lines[0].Line[C].Note[N].Length := Round(Lines[0].Line[C].Note[N].Length / 2); end; // N end; // C @@ -696,11 +737,13 @@ var N: integer; begin CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM * 2; - for C := 0 to Lines[0].High do begin - Lines[0].Line[C].Start := Lines[0].Line[C].Start * 2; - Lines[0].Line[C].End_ := Lines[0].Line[C].End_ * 2; - for N := 0 to Lines[0].Line[C].HighNote do begin - Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start * 2; + for C := 0 to Lines[0].High do + begin + Lines[0].Line[C].Start := Lines[0].Line[C].Start * 2; + Lines[0].Line[C].End_ := Lines[0].Line[C].End_ * 2; + for N := 0 to Lines[0].Line[C].HighNote do + begin + Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start * 2; Lines[0].Line[C].Note[N].Length := Lines[0].Line[C].Note[N].Length * 2; end; // N end; // C @@ -717,7 +760,8 @@ begin for N := 0 to Lines[0].Line[C].HighNut do Lines[0].Line[C].Note[N].Text := AnsiLowerCase(Lines[0].Line[C].Note[N].Text);} - for C := 0 to Lines[0].High do begin + for C := 0 to Lines[0].High do + begin S := AnsiUpperCase(Copy(Lines[0].Line[C].Note[0].Text, 1, 1)); S := S + Copy(Lines[0].Line[C].Note[0].Text, 2, Length(Lines[0].Line[C].Note[0].Text)-1); Lines[0].Line[C].Note[0].Text := S; @@ -729,33 +773,39 @@ var C: integer; N: integer; begin - for C := 0 to Lines[0].High do begin + for C := 0 to Lines[0].High do + begin // correct starting spaces in the first word while Copy(Lines[0].Line[C].Note[0].Text, 1, 1) = ' ' do Lines[0].Line[C].Note[0].Text := Copy(Lines[0].Line[C].Note[0].Text, 2, 100); // move spaces on the start to the end of the previous note - for N := 1 to Lines[0].Line[C].HighNote do begin - while (Copy(Lines[0].Line[C].Note[N].Text, 1, 1) = ' ') do begin + for N := 1 to Lines[0].Line[C].HighNote do + begin + while (Copy(Lines[0].Line[C].Note[N].Text, 1, 1) = ' ') do + begin Lines[0].Line[C].Note[N].Text := Copy(Lines[0].Line[C].Note[N].Text, 2, 100); Lines[0].Line[C].Note[N-1].Text := Lines[0].Line[C].Note[N-1].Text + ' '; end; end; // N // correct '-' to '- ' - for N := 0 to Lines[0].Line[C].HighNote do begin + for N := 0 to Lines[0].Line[C].HighNote do + begin if Lines[0].Line[C].Note[N].Text = '-' then Lines[0].Line[C].Note[N].Text := '- '; end; // N // add space to the previous note when the current word is '- ' - for N := 1 to Lines[0].Line[C].HighNote do begin + for N := 1 to Lines[0].Line[C].HighNote do + begin if Lines[0].Line[C].Note[N].Text = '- ' then Lines[0].Line[C].Note[N-1].Text := Lines[0].Line[C].Note[N-1].Text + ' '; end; // N // correct too many spaces at the end of note - for N := 0 to Lines[0].Line[C].HighNote do begin + for N := 0 to Lines[0].Line[C].HighNote do + begin while Copy(Lines[0].Line[C].Note[N].Text, Length(Lines[0].Line[C].Note[N].Text)-1, 2) = ' ' do Lines[0].Line[C].Note[N].Text := Copy(Lines[0].Line[C].Note[N].Text, 1, Length(Lines[0].Line[C].Note[N].Text)-1); end; // N @@ -775,8 +825,10 @@ var Min: integer; Max: integer; begin - for C := 1 to Lines[0].High do begin - with Lines[0].Line[C-1] do begin + for C := 1 to Lines[0].High do + begin + with Lines[0].Line[C-1] do + begin Min := Note[HighNote].Start + Note[HighNote].Length; Max := Lines[0].Line[C].Note[0].Start; case (Max - Min) of @@ -830,7 +882,8 @@ begin // move right notes to new sentences NHigh := Lines[0].Line[CStart].HighNote; - for N := NStart to NHigh do begin + for N := NStart to NHigh do + begin // increase sentence counters with Lines[0].Line[CNew] do begin @@ -871,7 +924,8 @@ begin SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); // move right notes to new sentences - for N := 0 to Lines[0].Line[C+1].HighNote do begin + for N := 0 to Lines[0].Line[C+1].HighNote do + begin NDst := NStart + N; Lines[0].Line[C].Note[NDst] := Lines[0].Line[C+1].Note[N]; end; @@ -904,7 +958,8 @@ begin SetLength(Note, HighNote + 1); // we copy all notes including selected one - for N := HighNote downto CurrentNote+1 do begin + for N := HighNote downto CurrentNote+1 do + begin Note[N] := Note[N-1]; end; @@ -929,7 +984,8 @@ begin begin // we copy all notes from the next to the selected one - for N := CurrentNote+1 to Lines[0].Line[C].HighNote do begin + for N := CurrentNote+1 to Lines[0].Line[C].HighNote do + begin Lines[0].Line[C].Note[N-1] := Lines[0].Line[C].Note[N]; end; @@ -977,7 +1033,8 @@ var C: integer; N: integer; begin - for C := 0 to Lines[0].High do begin + for C := 0 to Lines[0].High do + begin Lines[0].Line[C].BaseNote := Lines[0].Line[C].BaseNote + Tone; for N := 0 to Lines[0].Line[C].HighNote do Lines[0].Line[C].Note[N].Tone := Lines[0].Line[C].Note[N].Tone + Tone; @@ -990,13 +1047,17 @@ var N: integer; NStart: integer; begin - for C := Lines[0].Current to Lines[0].High do begin + for C := Lines[0].Current to Lines[0].High do + begin NStart := 0; - if C = Lines[0].Current then NStart := CurrentNote; - for N := NStart to Lines[0].Line[C].HighNote do begin + if C = Lines[0].Current then + NStart := CurrentNote; + for N := NStart to Lines[0].Line[C].HighNote do + begin Inc(Lines[0].Line[C].Note[N].Start, Move); // move note start - if N = 0 then begin // fix beginning + if N = 0 then + begin // fix beginning Inc(Lines[0].Line[C].Start, Move); end; @@ -1028,7 +1089,8 @@ begin Lines[0].Line[C].Note[NHigh].Text := Lines[0].Line[C].Note[NHigh-1].Text + Lines[0].Line[C].Note[NHigh].Text; // other words - for N := NHigh - 1 downto CurrentNote + 1 do begin + for N := NHigh - 1 downto CurrentNote + 1 do + begin Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N-1].Text; end; // for Lines[0].Line[C].Note[CurrentNote].Text := '- '; @@ -1052,10 +1114,10 @@ end; procedure TScreenEditSub.CopySentence(Src, Dst: integer); var - N: integer; - Time1: integer; - Time2: integer; - TD: integer; + N: integer; + Time1: integer; + Time2: integer; + TD: integer; begin Time1 := Lines[0].Line[Src].Note[0].Start; Time2 := Lines[0].Line[Dst].Note[0].Start; @@ -1063,7 +1125,8 @@ begin SetLength(Lines[0].Line[Dst].Note, Lines[0].Line[Src].HighNote + 1); Lines[0].Line[Dst].HighNote := Lines[0].Line[Src].HighNote; - for N := 0 to Lines[0].Line[Src].HighNote do begin + for N := 0 to Lines[0].Line[Src].HighNote do + begin Lines[0].Line[Dst].Note[N].Text := Lines[0].Line[Src].Note[N].Text; Lines[0].Line[Dst].Note[N].Length := Lines[0].Line[Src].Note[N].Length; Lines[0].Line[Dst].Note[N].Tone := Lines[0].Line[Src].Note[N].Tone; @@ -1081,12 +1144,14 @@ begin SetLength(Lines[0].Line, Lines[0].Number + Num - 1); // moves sentences next to the destination - for C := Lines[0].High downto Dst + 1 do begin + for C := Lines[0].High downto Dst + 1 do + begin Lines[0].Line[C + Num - 1] := Lines[0].Line[C]; end; // prepares new sentences: sets sentence start and create first note - for C := 1 to Num-1 do begin + for C := 1 to Num-1 do + begin Lines[0].Line[Dst + C].Start := Lines[0].Line[Dst + C - 1].Note[0].Start + (Lines[0].Line[Src + C].Note[0].Start - Lines[0].Line[Src + C - 1].Note[0].Start); SetLength(Lines[0].Line[Dst + C].Note, 1); @@ -1168,9 +1233,10 @@ begin try //Check if File is XML - if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' - then Error := not CurrentSong.LoadXMLSong() - else Error := not CurrentSong.LoadSong(); + if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' then + Error := not CurrentSong.LoadXMLSong() + else + Error := not CurrentSong.LoadSong(); except Error := True; end; @@ -1182,7 +1248,8 @@ begin ScreenPopupError.ShowPopup (Language.Translate('ERROR_CORRUPT_SONG')); Exit; end - else begin + else + begin {$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); if Ini.Debug = 1 then @@ -1231,13 +1298,15 @@ begin glClearColor(1,1,1,1); // midi music - if PlaySentenceMidi then begin + if PlaySentenceMidi then + begin {$IFDEF UseMIDIPort} MidiPos := USTime.GetTime - MidiTime + MidiStart; // stop the music - if (MidiPos > MidiStop) then begin + if (MidiPos > MidiStop) then + begin MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; end; @@ -1247,7 +1316,8 @@ begin AktBeat := Floor(GetMidBeat(MidiPos - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); - if AktBeat <> LastClick then begin + if AktBeat <> LastClick then + begin for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNote do if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then begin @@ -1266,7 +1336,8 @@ begin end; // if PlaySentenceMidi // mp3 music - if PlaySentence then begin + if PlaySentence then + begin // stop the music if (AudioPlayback.Position > PlayStopTime) then begin @@ -1275,11 +1346,13 @@ begin end; // click - if (Click) and (PlaySentence) then begin + if (Click) and (PlaySentence) then + begin // AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); - if AktBeat <> LastClick then begin + if AktBeat <> LastClick then + begin for Pet := 0 to Lines[0].Line[Lines[0].Current].HighNote do if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then begin @@ -1340,8 +1413,8 @@ begin //Music.SetVolume(1.0); end; -function TScreenEditSub.GetNoteName(Note: Integer): String; -var N1, N2: Integer; +function TScreenEditSub.GetNoteName(Note: integer): string; +var N1, N2: integer; begin if (Note > 0) then begin -- cgit v1.2.3 From 65a64b2404ae4e7c4c5e75724e25a1189c29c3ad Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 26 Nov 2008 21:38:59 +0000 Subject: replace integer by enumeration type alignment git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1526 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 949dffae..873d7185 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -530,7 +530,7 @@ begin end; // ctrl + left - if SDL_ModState = KMOD_LCTRL the + if SDL_ModState = KMOD_LCTRL then begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); @@ -1270,7 +1270,7 @@ begin Lyric.Clear; Lyric.X := 400; Lyric.Y := 500; - Lyric.Align := 1; + Lyric.Align := center; Lyric.Size := 42; Lyric.ColR := 0; Lyric.ColG := 0; -- cgit v1.2.3 From d826e9135078f7fa719046069ce10da1e382bfc3 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 27 Nov 2008 21:50:41 +0000 Subject: some more formatting git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1530 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 26 +++-- src/screens/UScreenEditConvert.pas | 229 ++++++++++++++++++++++--------------- src/screens/UScreenEditHeader.pas | 147 +++++++++++++++--------- src/screens/UScreenEditSub.pas | 65 +++++------ 4 files changed, 276 insertions(+), 191 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index caeaac11..1fc2fcdc 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -33,7 +33,10 @@ interface {$I switches.inc} -uses UMenu, SDL, UThemes; +uses + UMenu, + SDL, + UThemes; type TScreenEdit = class(TMenu) @@ -44,19 +47,23 @@ type FileName: string;} constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; { function Draw: boolean; override; procedure Finish;} end; implementation -uses UGraphic, UMusic, USkins, SysUtils; +uses + UGraphic, + UMusic, + USkins, + SysUtils; -function TScreenEdit.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -83,7 +90,8 @@ begin AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEditConvert); end; -// if Interaction = 1 then begin +// if Interaction = 1 then +// begin // Music.PlayStart; // FadeTo(@ScreenEditHeader); // end; @@ -134,9 +142,9 @@ end; (*function TScreenEdit.Draw: boolean; var - Min: integer; - Sec: integer; - AktBeat: integer; + Min: integer; + Sec: integer; + AktBeat: integer; begin end; diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 97a4bf2c..24f2730c 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -33,35 +33,36 @@ interface {$I switches.inc} -uses UMenu, - SDL, - {$IFDEF UseMIDIPort} - MidiFile, - MidiOut, - {$ENDIF} - ULog, - USongs, - USong, - UMusic, - UThemes; +uses + UMenu, + SDL, + {$IFDEF UseMIDIPort} + MidiFile, + MidiOut, + {$ENDIF} + ULog, + USongs, + USong, + UMusic, + UThemes; type TNote = record - Event: integer; - EventType: integer; - Channel: integer; - Start: real; - Len: real; - Data1: integer; - Data2: integer; - Str: string; + Event: integer; + EventType: integer; + Channel: integer; + Start: real; + Len: real; + Data1: integer; + Data2: integer; + Str: string; end; TTrack = record - Note: array of TNote; - Name: string; - Hear: boolean; - Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics + Note: array of TNote; + Name: string; + Hear: boolean; + Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics end; TNuta = record @@ -76,29 +77,29 @@ type TScreenEditConvert = class(TMenu) public - ATrack: TArrayTrack; // actual track -// Track: TArrayTrack; - Channel: TArrayTrack; - ColR: array[0..100] of real; - ColG: array[0..100] of real; - ColB: array[0..100] of real; - Len: real; - Sel: integer; - Selected: boolean; -// FileName: string; + ATrack: TArrayTrack; // actual track +// Track: TArrayTrack; + Channel: TArrayTrack; + ColR: array[0..100] of real; + ColG: array[0..100] of real; + ColB: array[0..100] of real; + Len: real; + Sel: integer; + Selected: boolean; +// FileName: string; {$IFDEF UseMIDIPort} - MidiFile: TMidiFile; - MidiTrack: TMidiTrack; - MidiEvent: pMidiEvent; - MidiOut: TMidiOutput; + MidiFile: TMidiFile; + MidiTrack: TMidiTrack; + MidiEvent: pMidiEvent; + MidiOut: TMidiOutput; {$ENDIF} - Song: TSong; - Lines: TLines; - BPM: real; - Ticks: real; - Note: array of TNuta; + Song: TSong; + Lines: TLines; + BPM: real; + Ticks: real; + Note: array of TNuta; procedure AddLyric(Start: integer; Text: string); procedure Extract; @@ -110,23 +111,25 @@ type function SelectedNumber: integer; constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure onHide; override; end; implementation -uses UGraphic, - SysUtils, - UDrawTexture, - TextGL, - UFiles, - UMain, - UIni, - gl, - USkins; - -function TScreenEditConvert.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; + +uses + UGraphic, + SysUtils, + UDrawTexture, + TextGL, + UFiles, + UMain, + UIni, + gl, + USkins; + +function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; If (PressedDown) Then @@ -171,13 +174,16 @@ begin {$ENDIF} end; - if Interaction = 2 then begin + if Interaction = 2 then + begin Selected := true; {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := nil; {$ENDIF} - {for T := 0 to High(ATrack) do begin - if ATrack[T].Hear then begin + {for T := 0 to High(ATrack) do + begin + if ATrack[T].Hear then + begin MidiTrack := MidiFile.GetTrack(T); MidiTrack.OnMidiEvent := MidiFile1MidiEvent; end; @@ -185,8 +191,10 @@ begin MidiFile.StartPlaying;//} end; - if Interaction = 3 then begin - if SelectedNumber > 0 then begin + if Interaction = 3 then + begin + if SelectedNumber > 0 then + begin Extract; SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false); end; @@ -199,7 +207,8 @@ begin // ATrack[Sel].Hear := not ATrack[Sel].Hear; ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; -{ if Selected then begin +{ if Selected then + begin MidiTrack := MidiFile.GetTrack(Sel); if Track[Sel].Hear then MidiTrack.OnMidiEvent := MidiFile1MidiEvent @@ -221,12 +230,14 @@ begin SDLK_DOWN: begin Inc(Sel); - if Sel > High(ATrack) then Sel := 0; + if Sel > High(ATrack) then + Sel := 0; end; SDLK_UP: begin Dec(Sel); - if Sel < 0 then Sel := High(ATrack); + if Sel < 0 then + Sel := High(ATrack); end; end; end; @@ -236,11 +247,15 @@ procedure TScreenEditConvert.AddLyric(Start: integer; Text: string); var N: integer; begin - for N := 0 to High(Note) do begin - if Note[N].Start = Start then begin + for N := 0 to High(Note) do + begin + if Note[N].Start = Start then + begin // check for new sentece - if Copy(Text, 1, 1) = '\' then Delete(Text, 1, 1); - if Copy(Text, 1, 1) = '/' then begin + if Copy(Text, 1, 1) = '\' then + Delete(Text, 1, 1); + if Copy(Text, 1, 1) = '/' then + begin Delete(Text, 1, 1); Note[N].NewSentence := true; end; @@ -275,11 +290,16 @@ begin SetLength(Note, 0); // extract notes - for T := 0 to High(ATrack) do begin -// if ATrack[T].Hear then begin - if ((ATrack[T].Status div 1) and 1) = 1 then begin - for N := 0 to High(ATrack[T].Note) do begin - if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then begin + for T := 0 to High(ATrack) do + begin +// if ATrack[T].Hear then +// begin + if ((ATrack[T].Status div 1) and 1) = 1 then + begin + for N := 0 to High(ATrack[T].Note) do + begin + if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then + begin Nu := Length(Note); SetLength(Note, Nu + 1); Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); @@ -292,11 +312,16 @@ begin end; // extract lyrics - for T := 0 to High(ATrack) do begin -// if ATrack[T].Hear then begin - if ((ATrack[T].Status div 2) and 1) = 1 then begin - for N := 0 to High(ATrack[T].Note) do begin - if (ATrack[T].Note[N].EventType = 15) then begin + for T := 0 to High(ATrack) do + begin +// if ATrack[T].Hear then +// begin + if ((ATrack[T].Status div 2) and 1) = 1 then + begin + for N := 0 to High(ATrack[T].Note) do + begin + if (ATrack[T].Note[N].EventType = 15) then + begin // Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); end; @@ -307,7 +332,8 @@ begin // sort notes for N := 0 to High(Note) do for Nu := 0 to High(Note)-1 do - if Note[Nu].Start > Note[Nu+1].Start then begin + if Note[Nu].Start > Note[Nu+1].Start then + begin NoteTemp := Note[Nu]; Note[Nu] := Note[Nu+1]; Note[Nu+1] := NoteTemp; @@ -327,8 +353,10 @@ begin N := 0; Lines.Line[C].HighNote := -1; - for Nu := 0 to High(Note) do begin - if Note[Nu].NewSentence then begin // new line + for Nu := 0 to High(Note) do + begin + if Note[Nu].NewSentence then // new line + begin SetLength(Lines.Line, Length(Lines.Line)+1); Lines.Number := Lines.Number + 1; Lines.High := Lines.High + 1; @@ -379,8 +407,10 @@ var begin Result := 0; for T := 0 to High(ATrack) do -// if ATrack[T].Hear then Inc(Result); - if ((ATrack[T].Status div 1) and 1) = 1 then Inc(Result); +// if ATrack[T].Hear then +// Inc(Result); + if ((ATrack[T].Status div 1) and 1) = 1 then + Inc(Result); end; {$IFDEF UseMIDIPort} @@ -424,7 +454,8 @@ begin MidiFile := TMidiFile.Create(nil); {$ENDIF} - for P := 0 to 100 do begin + for P := 0 to 100 do + begin ColR[P] := Random(10)/10; ColG[P] := Random(10)/10; ColB[P] := Random(10)/10; @@ -460,13 +491,15 @@ begin BPM := MidiFile.Bpm; Ticks := MidiFile.TicksPerQuarter / 4; -{ for T := 0 to MidiFile.NumberOfTracks-1 do begin +{ for T := 0 to MidiFile.NumberOfTracks-1 do + begin SetLength(Track, Length(Track)+1); MidiTrack := MidiFile.GetTrack(T); MidiTrack.OnMidiEvent := MidiFile1MidiEvent; Track[T].Name := MidiTrack.getName; - for N := 0 to MidiTrack.getEventCount-1 do begin + for N := 0 to MidiTrack.getEventCount-1 do + begin SetLength(Track[T].Note, Length(Track[T].Note)+1); MidiEvent := MidiTrack.GetEvent(N); Track[T].Note[N].Start := MidiEvent.time; @@ -492,11 +525,13 @@ begin Channel[T].Status := 0; end; - for T := 0 to MidiFile.NumberOfTracks-1 do begin + for T := 0 to MidiFile.NumberOfTracks-1 do + begin MidiTrack := MidiFile.GetTrack(T); MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - for N := 0 to MidiTrack.getEventCount-1 do begin + for N := 0 to MidiTrack.getEventCount-1 do + begin MidiEvent := MidiTrack.GetEvent(N); C := MidiEvent.event and 15; @@ -526,8 +561,8 @@ end; function TScreenEditConvert.Draw: boolean; var - Count: integer; - Count2: integer; + Count: integer; + Count2: integer; Bottom: real; X: real; Y: real; @@ -540,7 +575,8 @@ begin Y := 100; H := Length(ATrack)*40; - if H > 480 then H := 480; + if H > 480 then + H := 480; Bottom := Y + H; YSkip := H / Length(ATrack); @@ -553,13 +589,16 @@ begin if ATrack[Count].Hear then DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); - for Count := 0 to High(ATrack) do begin - if ((ATrack[Count].Status div 1) and 1) = 1 then begin + for Count := 0 to High(ATrack) do + begin + if ((ATrack[Count].Status div 1) and 1) = 1 then + begin SetFontPos(25, Y + Count*YSkip + 10); SetFontSize(15); glPrint('N'); end; - if ((ATrack[Count].Status div 2) and 1) = 1 then begin + if ((ATrack[Count].Status div 2) and 1) = 1 then + begin SetFontPos(40, Y + Count*YSkip + 10); SetFontSize(15); glPrint('L'); @@ -573,14 +612,16 @@ begin for Count := 0 to Length(ATrack) do DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0); - for Count := 0 to High(ATrack) do begin + for Count := 0 to High(ATrack) do + begin SetFontPos(11, Y + 10 + Count*YSkip); SetFontSize(15); glPrint(ATrack[Count].Name); end; for Count := 0 to High(ATrack) do - for Count2 := 0 to High(ATrack[Count].Note) do begin + for Count2 := 0 to High(ATrack[Count].Note) do + begin if ATrack[Count].Note[Count2].EventType = 9 then DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]); if ATrack[Count].Note[Count2].EventType = 15 then diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index 3678973e..fb0b2c85 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -33,11 +33,12 @@ interface {$I switches.inc} -uses UMenu, - SDL, - USongs, - USong, - UThemes; +uses + UMenu, + SDL, + USongs, + USong, + UThemes; type TScreenEditHeader = class(TMenu) @@ -72,22 +73,28 @@ type constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; { function Draw: boolean; override; procedure Finish;} end; implementation -uses UGraphic, UMusic, SysUtils, UFiles, USkins, UTexture; +uses + UGraphic, + UMusic, + SysUtils, + UFiles, + USkins, + UTexture; -function TScreenEditHeader.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenEditHeader.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var T: integer; begin Result := true; - If (PressedDown) Then begin // Key Down - // check normal keys + if (PressedDown) then // Key Down + begin // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin @@ -107,7 +114,8 @@ begin SDLK_RETURN: begin - if Interaction = 1 then begin + if Interaction = 1 then + begin // Save; end; end; @@ -116,14 +124,14 @@ begin begin case Interaction of 0..0: InteractNext; - 1: Interaction := 0; + 1: Interaction := 0; end; end; SDLK_LEFT: begin case Interaction of - 0: Interaction := 1; + 0: Interaction := 1; 1..1: InteractPrev; end; end; @@ -131,25 +139,26 @@ begin SDLK_DOWN: begin case Interaction of - 0..1: Interaction := 2; - 2..12: InteractNext; - 13: Interaction := 0; + 0..1: Interaction := 2; + 2..12: InteractNext; + 13: Interaction := 0; end; end; SDLK_UP: begin case Interaction of - 0..1: Interaction := 13; - 2: Interaction := 0; - 3..13: InteractPrev; + 0..1: Interaction := 13; + 2: Interaction := 0; + 3..13: InteractPrev; end; end; SDLK_BACKSPACE: begin T := Interaction - 2 + TextTitle; - if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin + if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then + begin Text[T].DeleteLastL; SetRoundButtons; end; @@ -159,7 +168,8 @@ begin case CharCode of #32..#255: begin - if (Interaction >= 2) and (Interaction <= 13) then begin + if (Interaction >= 2) and (Interaction <= 13) then + begin Text[Interaction - 2 + TextTitle].Text := Text[Interaction - 2 + TextTitle].Text + CharCode; SetRoundButtons; @@ -244,7 +254,8 @@ procedure TScreenEditHeader.onShow; begin inherited; -{ if FileExists(FileName) then begin // load file +{ if FileExists(FileName) then // load file + begin CurrentSong.FileName := FileName; SkanujPlik(CurrentSong); @@ -273,28 +284,33 @@ end; (*function TScreenEdit.Draw: boolean; var - Min: integer; - Sec: integer; - Count: integer; - AktBeat: integer; + Min: integer; + Sec: integer; + Count: integer; + AktBeat: integer; begin { glClearColor(1,1,1,1); // control music - if PlaySentence then begin + if PlaySentence then + begin // stop the music - if (Music.Position > PlayStopTime) then begin + if (Music.Position > PlayStopTime) then + begin Music.Stop; PlaySentence := false; end; // click - if (Click) and (PlaySentence) then begin + if (Click) and (PlaySentence) then + begin AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); Text[TextDebug].Text := IntToStr(AktBeat); - if AktBeat <> LastClick then begin + if AktBeat <> LastClick then + begin for Count := 0 to Czesci[0].Czesc[Czesci[0].Akt].HighNut do - if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Count].Start = AktBeat) then begin + if (Czesci[0].Czesc[Czesci[0].Akt].Nuta[Count].Start = AktBeat) then + begin Music.PlayClick; LastClick := AktBeat; end; @@ -330,37 +346,52 @@ end;*) procedure TScreenEditHeader.SetRoundButtons; begin - if Length(Text[TextTitle].Text) > 0 then Static[StaticTitle].Visible := true - else Static[StaticTitle].Visible := false; - - if Length(Text[TextArtist].Text) > 0 then Static[StaticArtist].Visible := true - else Static[StaticArtist].Visible := false; - - if Length(Text[TextMp3].Text) > 0 then Static[StaticMp3].Visible := true - else Static[StaticMp3].Visible := false; - - if Length(Text[TextBackground].Text) > 0 then Static[StaticBackground].Visible := true - else Static[StaticBackground].Visible := false; - - if Length(Text[TextVideo].Text) > 0 then Static[StaticVideo].Visible := true - else Static[StaticVideo].Visible := false; + if Length(Text[TextTitle].Text) > 0 then + Static[StaticTitle].Visible := true + else + Static[StaticTitle].Visible := false; + + if Length(Text[TextArtist].Text) > 0 then + Static[StaticArtist].Visible := true + else + Static[StaticArtist].Visible := false; + + if Length(Text[TextMp3].Text) > 0 then + Static[StaticMp3].Visible := true + else + Static[StaticMp3].Visible := false; + + if Length(Text[TextBackground].Text) > 0 then + Static[StaticBackground].Visible := true + else + Static[StaticBackground].Visible := false; + + if Length(Text[TextVideo].Text) > 0 then + Static[StaticVideo].Visible := true + else + Static[StaticVideo].Visible := false; try StrToFloat(Text[TextVideoGAP].Text); - if StrToFloat(Text[TextVideoGAP].Text)<> 0 then Static[StaticVideoGAP].Visible := true - else Static[StaticVideoGAP].Visible := false; + if StrToFloat(Text[TextVideoGAP].Text)<> 0 then + Static[StaticVideoGAP].Visible := true + else + Static[StaticVideoGAP].Visible := false; except Static[StaticVideoGAP].Visible := false; end; - if LowerCase(Text[TextRelative].Text) = 'yes' then Static[StaticRelative].Visible := true - else Static[StaticRelative].Visible := false; + if LowerCase(Text[TextRelative].Text) = 'yes' then + Static[StaticRelative].Visible := true + else + Static[StaticRelative].Visible := false; try StrToInt(Text[TextResolution].Text); - if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) - then Static[StaticResolution].Visible := true - else Static[StaticResolution].Visible := false; + if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) then + Static[StaticResolution].Visible := true + else + Static[StaticResolution].Visible := false; except Static[StaticResolution].Visible := false; end; @@ -375,8 +406,10 @@ begin // start try StrToFloat(Text[TextStart].Text); - if (StrToFloat(Text[TextStart].Text) > 0) then Static[StaticStart].Visible := true - else Static[StaticStart].Visible := false; + if (StrToFloat(Text[TextStart].Text) > 0) then + Static[StaticStart].Visible := true + else + Static[StaticStart].Visible := false; except Static[StaticStart].Visible := false; end; @@ -392,8 +425,10 @@ begin // BPM try StrToFloat(Text[TextBPM].Text); - if (StrToFloat(Text[TextBPM].Text) > 0) then Static[StaticBPM].Visible := true - else Static[StaticBPM].Visible := false; + if (StrToFloat(Text[TextBPM].Text) > 0) then + Static[StaticBPM].Visible := true + else + Static[StaticBPM].Visible := false; except Static[StaticBPM].Visible := false; end; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 873d7185..07113363 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -33,25 +33,25 @@ interface {$I switches.inc} uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - USong, - UIni, - ULog, - UTexture, - UMenuText, - UEditorLyrics, - Math, - gl, - {$IFDEF UseMIDIPort} - MidiOut, - {$ENDIF} - UThemes; + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + USong, + UIni, + ULog, + UTexture, + UMenuText, + UEditorLyrics, + Math, + gl, + {$IFDEF UseMIDIPort} + MidiOut, + {$ENDIF} + UThemes; type TScreenEditSub = class(TMenu) @@ -80,18 +80,18 @@ type CopySrc: integer; {$IFDEF UseMIDIPort} - MidiOut: TMidiOutput; + MidiOut: TMidiOutput; {$endif} - MidiStart: real; - MidiStop: real; - MidiTime: real; - MidiPos: real; - MidiLastNote: integer; + MidiStart: real; + MidiStop: real; + MidiTime: real; + MidiPos: real; + MidiLastNote: integer; - TextEditMode: boolean; + TextEditMode: boolean; - Lyric: TEditorLyrics; + Lyric: TEditorLyrics; procedure DivideBPM; procedure MultiplyBPM; @@ -588,7 +588,8 @@ begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(Lines[0].Current); CurrentNote := 0; - if Lines[0].Current > Lines[0].High then Lines[0].Current := 0; + if Lines[0].Current > Lines[0].High then + Lines[0].Current := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -724,7 +725,8 @@ begin begin Lines[0].Line[C].Start := Lines[0].Line[C].Start div 2; Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; - for N := 0 to Lines[0].Line[C].HighNote do begin + for N := 0 to Lines[0].Line[C].HighNote do + begin Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; Lines[0].Line[C].Note[N].Length := Round(Lines[0].Line[C].Note[N].Length / 2); end; // N @@ -1076,7 +1078,8 @@ var begin { C := Lines[0].Current; - for N := Lines[0].Line[C].HighNut downto 1 do begin + for N := Lines[0].Line[C].HighNut downto 1 do + begin Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N-1].Text; end; // for @@ -1427,8 +1430,6 @@ begin N2 := -1; end; - - case N1 of 0: Result := 'c'; 1: Result := 'c#'; -- cgit v1.2.3 From 1423d21d13e4c5b925ac3e73764ae666ce3b4e60 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 30 Nov 2008 12:57:27 +0000 Subject: Deluxe theme for Editor menu. Part 2. This part may break Classic theme. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1533 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 102 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 83 insertions(+), 19 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index 1fc2fcdc..7ad39c45 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -41,15 +41,28 @@ uses type TScreenEdit = class(TMenu) public -{ Tex_Background: TTexture; +{ + Tex_Background: TTexture; FadeOut: boolean; Path: string; - FileName: string;} + FileName: string; +} + TextDescription: integer; + TextDescriptionLong: integer; + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; + PressedDown: boolean): boolean; override; procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; -{ function Draw: boolean; override; - procedure Finish;} + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; + procedure SetAnimationProgress(Progress: real); override; +{ + function Draw: boolean; override; + procedure Finish; +} end; implementation @@ -60,12 +73,19 @@ uses USkins, SysUtils; -function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: WideChar; + PressedDown: boolean): boolean; +var + SDL_ModState: word; begin Result := true; + + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); + if (PressedDown) then begin // Key Down - // check normal keys + // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin @@ -103,14 +123,10 @@ begin end; end; - SDLK_DOWN: - begin - InteractNext; - end; - SDLK_UP: - begin - InteractPrev; - end; + SDLK_DOWN: InteractInc; + SDLK_UP: InteractDec; + SDLK_RIGHT: InteractNext; + SDLK_LEFT: InteractPrev; end; end; end; @@ -118,8 +134,14 @@ end; constructor TScreenEdit.Create; begin inherited Create; - AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); + + TextDescription := AddText(Theme.Edit.TextDescription); +// TextDescriptionLong := AddText(Theme.Edit.TextDescriptionLong); + + LoadFromTheme(Theme.Edit); + +// AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); +// AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); // Button[High(Button)].Text[0].Size := 11; // AddButton(400-200, 100 + 1*60, 400, 40, 'ButtonF'); @@ -128,9 +150,17 @@ begin // AddButton(400-200, 100 + 2*60, 400, 40, 'ButtonF'); // AddButtonText(10, 5, 0, 0, 0, 'Set GAP'); - AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); - AddButtonText(10, 5, 0, 0, 0, 'Exit'); +// AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); +// AddButtonText(10, 5, 0, 0, 0, 'Exit'); + AddButton(Theme.Edit.ButtonConvert); + AddButton(Theme.Edit.ButtonExit); + +{ + if (Length(Button[0].Text)=0) then + AddButtonText(14, 20, Theme.Edit.Description[0]); +} + Interaction := 0; end; procedure TScreenEdit.onShow; @@ -140,6 +170,40 @@ begin // Interaction := 0; end; +procedure TScreenEdit.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; +// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; +end; + +procedure TScreenEdit.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; +// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; +end; + +procedure TScreenEdit.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; +// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; +end; + +procedure TScreenEdit.InteractInc; +begin + inherited InteractInc; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; +// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; +end; + +procedure TScreenEdit.SetAnimationProgress(Progress: real); +begin + Static[0].Texture.ScaleW := Progress; + Static[0].Texture.ScaleH := Progress; +end; + (*function TScreenEdit.Draw: boolean; var Min: integer; -- cgit v1.2.3 From c07241bb99e29127b9f97df1958dfa75f7a14a93 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 3 Dec 2008 22:51:21 +0000 Subject: some cleanup and language files. Who does the others? git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1538 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 70 ++++++--------------------------------------- 1 file changed, 8 insertions(+), 62 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index 7ad39c45..d255c6ac 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -41,12 +41,6 @@ uses type TScreenEdit = class(TMenu) public -{ - Tex_Background: TTexture; - FadeOut: boolean; - Path: string; - FileName: string; -} TextDescription: integer; TextDescriptionLong: integer; @@ -59,10 +53,6 @@ type procedure InteractInc; override; procedure InteractDec; override; procedure SetAnimationProgress(Progress: real); override; -{ - function Draw: boolean; override; - procedure Finish; -} end; implementation @@ -101,7 +91,6 @@ begin begin AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenMain); -// Result := false; end; SDLK_RETURN: begin @@ -110,11 +99,6 @@ begin AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenEditConvert); end; -// if Interaction = 1 then -// begin -// Music.PlayStart; -// FadeTo(@ScreenEditHeader); -// end; if Interaction = 1 then begin @@ -136,66 +120,41 @@ begin inherited Create; TextDescription := AddText(Theme.Edit.TextDescription); -// TextDescriptionLong := AddText(Theme.Edit.TextDescriptionLong); LoadFromTheme(Theme.Edit); -// AddButton(400-200, 100 + 0*70, 400, 40, Skin.GetTextureFileName('ButtonF')); -// AddButtonText(10, 5, 0, 0, 0, 'Convert Midi to Txt'); -// Button[High(Button)].Text[0].Size := 11; - -// AddButton(400-200, 100 + 1*60, 400, 40, 'ButtonF'); -// AddButtonText(10, 5, 0, 0, 0, 'Edit Headers'); - -// AddButton(400-200, 100 + 2*60, 400, 40, 'ButtonF'); -// AddButtonText(10, 5, 0, 0, 0, 'Set GAP'); - -// AddButton(400-200, 100 + 3*60, 400, 40, Skin.GetTextureFileName('ButtonF')); -// AddButtonText(10, 5, 0, 0, 0, 'Exit'); - AddButton(Theme.Edit.ButtonConvert); +{ Some ideas for more: + AddButton(Theme.Edit.ButtonEditHeaders); + AddButton(Theme.Edit.ButtonAdjustGap); +} AddButton(Theme.Edit.ButtonExit); -{ - if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Edit.Description[0]); -} Interaction := 0; end; -procedure TScreenEdit.onShow; -begin - inherited; - -// Interaction := 0; -end; - procedure TScreenEdit.InteractNext; begin inherited InteractNext; - Text[TextDescription].Text := Theme.Edit.Description[Interaction]; -// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; end; procedure TScreenEdit.InteractPrev; begin inherited InteractPrev; - Text[TextDescription].Text := Theme.Edit.Description[Interaction]; -// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; end; procedure TScreenEdit.InteractDec; begin inherited InteractDec; - Text[TextDescription].Text := Theme.Edit.Description[Interaction]; -// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; end; procedure TScreenEdit.InteractInc; begin inherited InteractInc; - Text[TextDescription].Text := Theme.Edit.Description[Interaction]; -// Text[TextDescriptionLong].Text := Theme.Edit.DescriptionLong[Interaction]; + Text[TextDescription].Text := Theme.Edit.Description[Interaction]; end; procedure TScreenEdit.SetAnimationProgress(Progress: real); @@ -204,17 +163,4 @@ begin Static[0].Texture.ScaleH := Progress; end; -(*function TScreenEdit.Draw: boolean; -var - Min: integer; - Sec: integer; - AktBeat: integer; -begin -end; - -procedure TScreenEdit.Finish; -begin -// -end;*) - end. -- cgit v1.2.3 From 7ca23077718d5a14135ec88edebf27929b14e545 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 3 Dec 2008 23:13:47 +0000 Subject: broken build fixed. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1539 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index d255c6ac..5112e17a 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -47,7 +47,6 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; procedure InteractInc; override; -- cgit v1.2.3 From 1b3ba5ddb4b810b11eabdc8f2d99c5dca2a1063c Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 13 Dec 2008 21:11:10 +0000 Subject: replace terrible code by using a set for Notes and Lyrics. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1540 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditConvert.pas | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 24f2730c..56afdefd 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -62,7 +62,7 @@ type Note: array of TNote; Name: string; Hear: boolean; - Status: byte; // 0 - none, 1 - notes, 2 - lyrics, 3 - notes + lyrics + Status: set of (notes, lyrics); end; TNuta = record @@ -205,7 +205,16 @@ begin SDLK_SPACE: begin // ATrack[Sel].Hear := not ATrack[Sel].Hear; - ATrack[Sel].Status := (ATrack[Sel].Status + 1) mod 4; + if Notes in ATrack[Sel].Status then + begin + ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; + if Lyrics in ATrack[Sel].Status then + ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] + else + ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; + end + else + ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; { if Selected then begin @@ -294,7 +303,7 @@ begin begin // if ATrack[T].Hear then // begin - if ((ATrack[T].Status div 1) and 1) = 1 then + if Notes in ATrack[T].Status then begin for N := 0 to High(ATrack[T].Note) do begin @@ -316,7 +325,7 @@ begin begin // if ATrack[T].Hear then // begin - if ((ATrack[T].Status div 2) and 1) = 1 then + if Lyrics in ATrack[T].Status then begin for N := 0 to High(ATrack[T].Note) do begin @@ -409,7 +418,7 @@ begin for T := 0 to High(ATrack) do // if ATrack[T].Hear then // Inc(Result); - if ((ATrack[T].Status div 1) and 1) = 1 then + if Notes in ATrack[T].Status then Inc(Result); end; @@ -516,13 +525,12 @@ begin end; end;} - SetLength(Channel, 16); for T := 0 to 15 do begin Channel[T].Name := IntToStr(T+1); SetLength(Channel[T].Note, 0); - Channel[T].Status := 0; + Channel[T].Status := []; end; for T := 0 to MidiFile.NumberOfTracks-1 do @@ -591,13 +599,13 @@ begin glColor3f(0, 0, 0); for Count := 0 to High(ATrack) do begin - if ((ATrack[Count].Status div 1) and 1) = 1 then + if Notes in ATrack[Count].Status then begin SetFontPos(25, Y + Count*YSkip + 10); SetFontSize(15); glPrint('N'); end; - if ((ATrack[Count].Status div 2) and 1) = 1 then + if Lyrics in ATrack[Count].Status then begin SetFontPos(40, Y + Count*YSkip + 10); SetFontSize(15); -- cgit v1.2.3 From c6b630485c605900405e15fac7ff0f75a780815a Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 12 Jan 2009 17:04:44 +0000 Subject: removed unused functions git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1567 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 57 ------------------------------------------ 1 file changed, 57 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 7e85c5d4..6d410a97 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -246,63 +246,6 @@ begin Draw:=true; end; -function pixfmt_eq(fmt1,fmt2: TSDL_Pixelformat): boolean; -begin - if (fmt1.BitsPerPixel = fmt2.BitsPerPixel) and - (fmt1.BytesPerPixel = fmt2.BytesPerPixel) and - (fmt1.Rloss = fmt2.Rloss) and - (fmt1.Gloss = fmt2.Gloss) and - (fmt1.Bloss = fmt2.Bloss) and - (fmt1.Rmask = fmt2.Rmask) and - (fmt1.Gmask = fmt2.Gmask) and - (fmt1.Bmask = fmt2.Bmask) and - (fmt1.Rshift = fmt2.Rshift) and - (fmt1.Gshift = fmt2.Gshift) and - (fmt1.Bshift = fmt2.Bshift) - then - pixfmt_eq:=True - else - pixfmt_eq:=False; -end; - -function inttohexstr(i: cardinal):pchar; -var helper, i2, c:cardinal; - tmpstr: string; -begin - helper:=0; - i2:=i; - tmpstr:=''; - for c:=1 to 8 do - begin - helper:=(helper shl 4) or (i2 and $f); - i2:=i2 shr 4; - end; - for c:=1 to 8 do - begin - i2:=helper and $f; - helper := helper shr 4; - case i2 of - 0: tmpstr:=tmpstr+'0'; - 1: tmpstr:=tmpstr+'1'; - 2: tmpstr:=tmpstr+'2'; - 3: tmpstr:=tmpstr+'3'; - 4: tmpstr:=tmpstr+'4'; - 5: tmpstr:=tmpstr+'5'; - 6: tmpstr:=tmpstr+'6'; - 7: tmpstr:=tmpstr+'7'; - 8: tmpstr:=tmpstr+'8'; - 9: tmpstr:=tmpstr+'9'; - 10: tmpstr:=tmpstr+'a'; - 11: tmpstr:=tmpstr+'b'; - 12: tmpstr:=tmpstr+'c'; - 13: tmpstr:=tmpstr+'d'; - 14: tmpstr:=tmpstr+'e'; - 15: tmpstr:=tmpstr+'f'; - end; - end; - inttohexstr:=pchar(tmpstr); -end; - procedure TScreenCredits.onShow; begin inherited; -- cgit v1.2.3 From ee7b6bd1126a2059f7f5298ea40fc19305223961 Mon Sep 17 00:00:00 2001 From: tobigun Date: Mon, 19 Jan 2009 21:55:27 +0000 Subject: ESC saves settings in Record screen again git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1573 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsRecord.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index b622f56c..f6ff85c6 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -166,8 +166,8 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - // Escape -> save nothing - just leave this screen - + // TODO: Show Save/Abort screen + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; -- cgit v1.2.3 From 61ffacc8a90f6777a05bef43dda84e14cb70c04c Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 4 Feb 2009 18:01:17 +0000 Subject: Tabs_at_startup -> TabsAtStartup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1585 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 6aa8e955..28358353 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -392,21 +392,22 @@ begin 'R': begin - if (Songs.SongList.Count > 0) and (Mode = smNormal) then + if (Songs.SongList.Count > 0) and + (Mode = smNormal) then begin - if (SDL_ModState = KMOD_LSHIFT) and (Ini.Tabs_at_startup = 1) then //Random Category + if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then //Random Category begin I2 := 0; //Count Cats - for I:= low(CatSongs.Song) to high (CatSongs.Song) do + for I:= 0 to high(CatSongs.Song) do begin if CatSongs.Song[I].Main then Inc(I2); end; - I2 := Random (I2)+1; //Zufall + I2 := Random(I2)+1; //Zufall //Find Cat: - for I:= low(CatSongs.Song) to high (CatSongs.Song) do + for I:= 0 to high(CatSongs.Song) do begin if CatSongs.Song[I].Main then Dec(I2); @@ -425,14 +426,14 @@ begin end; end; end - else if (SDL_ModState = KMOD_LCTRL) and (Ini.Tabs_at_startup = 1) then //random in All Categorys + else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then //random in All Categorys begin repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; - until CatSongs.Song[I2].Main = false; + I2 := Random(high(CatSongs.Song)+1) + 1; + until (not CatSongs.Song[I2].Main); //Search Cat - for I := I2 downto low(CatSongs.Song) do + for I := I2 downto 0 do begin if CatSongs.Song[I].Main then break; @@ -476,20 +477,20 @@ begin if (Mode = smNormal) then begin //On Escape goto Cat-List Hack - if (Ini.Tabs_at_startup = 1) and (CatSongs.CatNumShow <> -1) then + if (Ini.TabsAtStartup = 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 + while (not CatSongs.Song[I].Main) do + begin + Dec(I); + if (I < 0) then break; - end; - if (I<= 1) then - Interaction := high(catsongs.Song) + end; + if (I <= 1) then + Interaction := high(CatSongs.Song) else - Interaction := I - 1; + Interaction := I - 1; //Stop Music StopMusicPreview(); @@ -544,7 +545,7 @@ begin end; SDLK_RETURN: begin - if Songs.SongList.Count > 0 then + if (Songs.SongList.Count > 0) then begin if CatSongs.Song[Interaction].Main then begin // clicked on Category Button @@ -601,7 +602,7 @@ begin if (CatSongs.CatNumShow > -2) then begin //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if Ini.TabsAtStartup = 1 then begin I := Interaction; if I <= 0 then I := 1; @@ -641,7 +642,7 @@ begin if (CatSongs.CatNumShow > -2) then begin //Cat Change Hack - if Ini.Tabs_at_startup = 1 then + if Ini.TabsAtStartup = 1 then begin I := Interaction; I2 := 0; @@ -731,7 +732,7 @@ begin end; } end; end; - end; + end; // if (PressedDown) end; constructor TScreenSong.Create; @@ -892,7 +893,7 @@ begin // 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 + if (Ini.TabsAtStartup = 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') + ')'; @@ -901,7 +902,7 @@ begin 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 + else if (Ini.TabsAtStartup = 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)); @@ -1366,7 +1367,7 @@ begin if Ini.Players = 4 then PlayersPlay := 6; //Cat Mod etc - if (Ini.Tabs_at_startup = 1) and (CatSongs.CatNumShow = -1) then + if (Ini.TabsAtStartup = 1) and (CatSongs.CatNumShow = -1) then begin CatSongs.ShowCategoryList; FixSelected; @@ -1674,7 +1675,7 @@ begin smNormal: //All Songs Just Select Random Song begin //When Tabs are activated then use Tab Method - if (Ini.Tabs_at_startup = 1) then + if (Ini.TabsAtStartup = 1) then begin repeat I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; -- cgit v1.2.3 From 4e87603e40eab74aeef640d67050a1e013c0192a Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 4 Feb 2009 21:00:17 +0000 Subject: many cosmetic changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1586 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSongMenu.pas | 366 ++++++++++++++++++++-------------------- 1 file changed, 182 insertions(+), 184 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index 7aa2e498..fb3b0f93 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -45,56 +45,55 @@ uses type TScreenSongMenu = class(TMenu) private - CurMenu: Byte; //Num of the cur. Shown Menu + CurMenu: byte; // num of the cur. shown menu public - Visible: Boolean; //Whether the Menu should be Drawn + Visible: boolean; // whether the menu should be drawn constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; function Draw: boolean; override; - procedure MenuShow(sMenu: Byte); + 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 = 64 or 1; + SM_Playlist_Add = 64 or 2; + SM_Playlist_New = 64 or 3; - SM_Playlist_Load = 64 or 8 or 1; - SM_Playlist_Del = 64 or 8 or 5; + SM_Playlist_DelItem = 64 or 5; + SM_Playlist_Load = 64 or 8 or 1; + SM_Playlist_Del = 64 or 8 or 5; - SM_Party_Main = 128 or 1; - SM_Party_Joker = 128 or 2; + SM_Party_Main = 128 or 1; + SM_Party_Joker = 128 or 2; var - ISelections: Array of String; - SelectValue: Integer; - + ISelections: array of string; + SelectValue: integer; implementation -uses UGraphic, - UMain, - UIni, - UTexture, - ULanguage, - UParty, - UPlaylist, - USongs; - -function TScreenSongMenu.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + USongs; + +function TScreenSongMenu.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then - begin // Key Down - if (CurMenu = SM_Playlist_New) AND (Interaction=0) then + begin // key down + if (CurMenu = SM_Playlist_New) and (Interaction=0) then begin // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -127,10 +126,10 @@ begin // check special keys case PressedKey of SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_BACKSPACE: begin AudioPlayback.PlaySound(SoundLib.Back); - Visible := False; + Visible := false; end; SDLK_RETURN: @@ -138,8 +137,8 @@ begin HandleReturn; end; - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; SDLK_RIGHT: begin @@ -153,8 +152,8 @@ begin end; SDLK_1: - begin //Jocker - //Use Joker + begin // jocker + // use joker case CurMenu of SM_Party_Main: begin @@ -163,8 +162,8 @@ begin end; end; SDLK_2: - begin //Jocker - //Use Joker + begin // jocker + // use joker case CurMenu of SM_Party_Main: begin @@ -173,8 +172,8 @@ begin end; end; SDLK_3: - begin //Jocker - //Use Joker + begin // jocker + // use joker case CurMenu of SM_Party_Main: begin @@ -189,12 +188,12 @@ end; constructor TScreenSongMenu.Create; begin inherited Create; - - //Create Dummy SelectSlide Entrys + + // create dummy selectslide entrys SetLength(ISelections, 1); ISelections[0] := 'Dummy'; - + AddText(Theme.SongMenu.TextMenu); LoadFromTheme(Theme.SongMenu); @@ -217,7 +216,6 @@ begin if (Length(Button[3].Text) = 0) then AddButtonText(14, 20, 'Button 4'); - Interaction := 0; end; @@ -229,24 +227,23 @@ end; procedure TScreenSongMenu.onShow; begin inherited; - end; -procedure TScreenSongMenu.MenuShow(sMenu: Byte); +procedure TScreenSongMenu.MenuShow(sMenu: byte); begin - Interaction := 0; //Reset Interaction - Visible := True; //Set Visible - Case sMenu of + 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].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'); @@ -259,11 +256,11 @@ 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].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'); @@ -276,11 +273,11 @@ 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].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'); @@ -294,9 +291,9 @@ begin end else begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; + 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; @@ -306,11 +303,11 @@ 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].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'); @@ -322,11 +319,11 @@ 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].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'); @@ -337,13 +334,13 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PLAYLIST_LOAD'); - //Show Delete Curent Playlist Button when Playlist is opened + // 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[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'); @@ -358,9 +355,9 @@ begin end else begin - Button[3].Visible := False; - SelectsS[0].Visible := False; - Button[2].Visible := True; + 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; @@ -371,27 +368,26 @@ 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].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].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'); @@ -404,172 +400,175 @@ begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); // to-do : Party - {Button[0].Visible := (PartySession.Teams.NumTeams >= 1) AND (PartySession.Teams.Teaminfo[0].Joker > 0); - Button[1].Visible := (PartySession.Teams.NumTeams >= 2) AND (PartySession.Teams.Teaminfo[1].Joker > 0); - Button[2].Visible := (PartySession.Teams.NumTeams >= 3) AND (PartySession.Teams.Teaminfo[2].Joker > 0);} - Button[3].Visible := True; - SelectsS[0].Visible := False; - - {Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); +{ + 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[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); +} Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); - //Set right Interaction + // 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; + Interaction := 4 + else + Interaction := 2; end - else Interaction := 1; + else + Interaction := 1; end; - + end; end; end; procedure TScreenSongMenu.HandleReturn; begin - Case CurMenu of + case CurMenu of SM_Main: begin - Case Interaction of - 0: //Button 1 + case Interaction of + 0: // button 1 begin ScreenSong.StartSong; - Visible := False; + Visible := false; end; - 1: //Button 2 + 1: // button 2 begin - //Select New Players then Sing: + // select new players then sing: ScreenSong.SelectPlayers; - Visible := False; + Visible := false; end; - 2: //Button 3 + 2: // button 3 begin - //Show add to Playlist Menu + // show add to playlist menu MenuShow(SM_Playlist_Add); end; - 3: //SelectSlide 3 + 3: // selectslide 3 begin //Dummy end; - 4: //Button 4 + 4: // button 4 begin ScreenSong.OpenEditor; - Visible := False; + Visible := false; end; end; end; SM_PlayList: begin - Visible := False; - Case Interaction of - 0: //Button 1 + Visible := false; + case Interaction of + 0: // button 1 begin ScreenSong.StartSong; - Visible := False; + Visible := false; end; - 1: //Button 2 + 1: // button 2 begin - //Select New Players then Sing: + // select new players then sing: ScreenSong.SelectPlayers; - Visible := False; + Visible := false; end; - 2: //Button 3 + 2: // button 3 begin - //Show add to Playlist Menu + // show add to playlist menu MenuShow(SM_Playlist_DelItem); end; - 3: //SelectSlide 3 + 3: // selectslide 3 begin - //Dummy + // dummy end; - 4: //Button 4 + 4: // button 4 begin ScreenSong.OpenEditor; - Visible := False; + Visible := false; end; end; end; SM_Playlist_Add: begin - Case Interaction of - 0: //Button 1 + case Interaction of + 0: // button 1 begin MenuShow(SM_Playlist_New); end; - 3: //SelectSlide 3 + 3: // selectslide 3 begin - //Dummy + // dummy end; - 4: //Button 4 + 4: // button 4 begin PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); - Visible := False; + Visible := false; end; end; end; SM_Playlist_New: begin - Case Interaction of - 0: //Button 1 + case Interaction of + 0: // button 1 begin - //Nothing, Button for Entering Name + // nothing, button for entering name end; - 2: //Button 3 + 2: // button 3 begin - //Create Playlist and Add Song + // create playlist and add song PlaylistMan.AddItem( ScreenSong.Interaction, PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); - Visible := False; + Visible := false; end; - 3: //SelectSlide 3 + 3: // selectslide 3 begin - //Cancel -> Go back to Add screen + // cancel -> go back to add screen MenuShow(SM_Playlist_Add); end; - 4: //Button 4 + 4: // button 4 begin - Visible := False; + Visible := false; end; end; end; SM_Playlist_DelItem: begin - Visible := False; - Case Interaction of - 0: //Button 1 + Visible := false; + case Interaction of + 0: // button 1 begin - //Delete + // delete PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); - Visible := False; + Visible := false; end; - 4: //Button 4 + 4: // button 4 begin MenuShow(SM_Playlist); end; @@ -578,32 +577,32 @@ begin SM_Playlist_Load: begin - Case Interaction of - 0: //Button 1 (Delete Playlist) + case Interaction of + 0: // button 1 (Delete playlist) begin MenuShow(SM_Playlist_Del); end; - 4: //Button 4 + 4: // button 4 begin - //Load Playlist + // load playlist PlaylistMan.SetPlayList(SelectValue); - Visible := False; + Visible := false; end; end; end; SM_Playlist_Del: begin - Visible := False; - Case Interaction of - 0: //Button 1 + Visible := false; + case Interaction of + 0: // button 1 begin - //Delete + // delete PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); - Visible := False; + Visible := false; end; - 4: //Button 4 + 4: // button 4 begin MenuShow(SM_Playlist_Load); end; @@ -612,17 +611,17 @@ begin SM_Party_Main: begin - Case Interaction of - 0: //Button 1 + case Interaction of + 0: // button 1 begin - //Start Singing + // start singing ScreenSong.StartSong; - Visible := False; + Visible := false; end; - 4: //Button 4 + 4: // button 4 begin - //Joker + // joker MenuShow(SM_Party_Joker); end; end; @@ -630,29 +629,29 @@ begin SM_Party_Joker: begin - Visible := False; - Case Interaction of - 0: //Button 1 + Visible := false; + case Interaction of + 0: // button 1 begin - //Joker Team 1 + // joker team 1 ScreenSong.DoJoker(0); end; - 1: //Button 2 + 1: // button 2 begin - //Joker Team 2 + // joker team 2 ScreenSong.DoJoker(1); end; - 2: //Button 3 + 2: // button 3 begin - //Joker Team 3 + // joker team 3 ScreenSong.DoJoker(2); end; - 4: //Button 4 + 4: // button 4 begin - //Cancel... (Fo back to old Menu) + // cancel... (go back to old menu) MenuShow(SM_Party_Main); end; end; @@ -661,4 +660,3 @@ begin end; end. - -- cgit v1.2.3 From c027a665e0d63c8aaba2833b60ec7834987fa8f9 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 4 Feb 2009 21:46:02 +0000 Subject: many cosmetic changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1587 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 262 +++++++++++++++++++++----------------------- 1 file changed, 127 insertions(+), 135 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index d49ecc7c..b7e6b0ec 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,7 +33,6 @@ interface {$I switches.inc} - uses UMenu, UMusic, SDL, @@ -61,22 +60,22 @@ type private VideoLoaded: boolean; protected - Paused: boolean; //Pause Mod + Paused: boolean; // pause mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public - // TimeBar fields + // timebar fields StaticTimeProgress: integer; TextTimeText: integer; StaticP1: integer; TextP1: integer; - //shown when game is in 2/4 player modus + // shown when game is in 2/4 player modus StaticP1TwoP: integer; TextP1TwoP: integer; - //shown when game is in 3/6 player modus + // shown when game is in 3/6 player modus StaticP1ThreeP: integer; TextP1ThreeP: integer; @@ -95,7 +94,7 @@ type FadeOut: boolean; Lyrics: TLyricEngine; - //Score Manager: + // score manager: Scores: TSingScores; fShowVisualization: boolean; @@ -105,21 +104,22 @@ type procedure onShow; override; procedure onShowFinish; override; procedure onHide; override; - + function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure Finish; virtual; - procedure Pause; // Toggle Pause + procedure Pause; // toggle pause - procedure OnSentenceEnd(SentenceIndex: cardinal); // for LineBonus + Singbar - procedure OnSentenceChange(SentenceIndex: cardinal); // for Golden Notes + procedure OnSentenceEnd(SentenceIndex: cardinal); // for linebonus + singbar + procedure OnSentenceChange(SentenceIndex: cardinal); // for golden notes end; implementation -uses UGraphic, +uses + UGraphic, UDraw, UMain, USong, @@ -128,29 +128,30 @@ uses UGraphic, ULanguage, Math; - // Method for input parsing. If False is returned, GetNextWindow - // should be checked to know the next window to load; +// method for input parsing. if false is returned, getnextwindow +// should be checked to know the next window to load; + function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; begin - Result := True; + Result := true; if (PressedDown) then - begin // Key Down - // check normal keys + begin // key down + // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin - //When not ask before Exit then Finish now + // 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 just pause and let the popup make the work else if not Paused then Pause; - Result := False; + Result := false; Exit; end; - 'V': //Show Visualization + 'V': // show visualization begin fShowVisualization := not fShowVisualization; @@ -176,7 +177,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - //Record Sound Hack: + // record sound hack: //Sound[0].BufferLong Finish; @@ -189,7 +190,7 @@ begin Pause; end; - SDLK_TAB: //Change Visualization Preset + SDLK_TAB: // change visualization preset begin if fShowVisualization then fCurrentVideoPlaybackEngine.Position := now; // move to a random position @@ -199,8 +200,8 @@ begin begin end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside + // 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 @@ -212,57 +213,57 @@ begin end; end; -//Pause Mod +// pause mod procedure TScreenSing.Pause; begin - if (not Paused) then //enable Pause + if (not Paused) then // enable pause begin - // pause Time - Paused := True; + // pause time + Paused := true; LyricsState.Pause(); - // pause Music + // pause music AudioPlayback.Pause; - // pause Video + // pause video if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; end - else //disable Pause + else // disable pause begin LyricsState.Resume(); - // Play Music + // play music AudioPlayback.Play; - // Video + // video if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then fCurrentVideoPlaybackEngine.Pause; - Paused := False; + Paused := false; end; end; -//Pause Mod End +// pause mod end constructor TScreenSing.Create; begin inherited Create; - fShowVisualization := False; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; - //Create Score Class + // create score class Scores := TSingScores.Create; Scores.LoadfromTheme; LoadFromTheme(Theme.Sing); - //TimeBar + // timebar StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); TextTimeText := AddText(Theme.Sing.TextTimeText); @@ -274,7 +275,7 @@ begin StaticP1TwoP := AddStatic(Theme.Sing.StaticP1TwoP); TextP1TwoP := AddText(Theme.Sing.TextP1TwoP); - // | P2 + // | P2 StaticP2R := AddStatic(Theme.Sing.StaticP2R); TextP2R := AddText(Theme.Sing.TextP2R); @@ -282,18 +283,18 @@ begin StaticP1ThreeP := AddStatic(Theme.Sing.StaticP1ThreeP); TextP1ThreeP := AddText(Theme.Sing.TextP1ThreeP); - // | P2 + // | P2 StaticP2M := AddStatic(Theme.Sing.StaticP2M); TextP2M := AddText(Theme.Sing.TextP2M); - // | P3 + // | P3 StaticP3R := AddStatic(Theme.Sing.StaticP3R); TextP3R := AddText(Theme.Sing.TextP3R); StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); - //Pausepopup is not visibile at the beginning - Static[StaticPausePopup].Visible := False; + // pausepopup is not visibile at the beginning + Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, @@ -306,8 +307,8 @@ procedure TScreenSing.onShow; var P: integer; V1: boolean; - V1TwoP: boolean; //Position of ScoreBox in two-player mode - V1ThreeP: boolean; //Position of ScoreBox in three-player mode + V1TwoP: boolean; // position of score box in two player mode + V1ThreeP: boolean; // position of score box in three player mode V2R: boolean; V2M: boolean; V3R: boolean; @@ -318,9 +319,9 @@ begin inherited; Log.LogStatus('Begin', 'onShow'); - FadeOut := False; + FadeOut := false; - // reset video playback engine, to play Video Clip... + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine := VideoPlayback; // setup score manager @@ -335,7 +336,7 @@ begin Scores.AddPlayer(Tex_ScoreBG[P], Color); end; - Scores.Init; //Get Positions for Players + Scores.Init; // get positions for players // prepare players SetLength(Player, PlayersPlay); @@ -343,92 +344,87 @@ begin case PlayersPlay of 1: begin - V1 := True; - V1TwoP := False; - V1ThreeP := False; - V2R := False; - V2M := False; - V3R := False; + 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; + 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; + 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; + 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; + V1 := false; + V1TwoP := false; + V1ThreeP := true; + V2R := false; + V2M := true; + V3R := true; end; end; - //This one is shown in 1P mode + // this one is shown in 1P mode Static[StaticP1].Visible := V1; Text[TextP1].Visible := V1; - - //This one is shown in 2/4P mode + // this one is shown in 2/4P mode Static[StaticP1TwoP].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; Static[StaticP2R].Visible := V2R; Text[TextP2R].Visible := V2R; - - //This one is shown in 3/6P mode + // this one is shown in 3/6P mode Static[StaticP1ThreeP].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Static[StaticP2M].Visible := V2M; Text[TextP2M].Visible := V2M; - Static[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; - - // FIXME: sets Path and Filename to '' + // FIXME: sets path and filename to '' ResetSingTemp; CurrentSong := CatSongs.Song[CatSongs.Selected]; - // FIXME: bad style, put the try-except into LoadSong() and not here + // FIXME: bad style, put the try-except into loadsong() and not here try - // Check if file is XML + // check if file is xml if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then success := CurrentSong.LoadXMLSong() else success := CurrentSong.LoadSong(); except - success := False; + success := false; end; if (not success) then @@ -447,7 +443,7 @@ begin Exit; end; - // reset video playback engine, to play video clip... + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine.Close; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -457,32 +453,32 @@ begin * + Blank : Nothing has been set, this is our fallback * + Picture : Picture has been set, and exists - otherwise we fallback * + Video : Video has been set, and exists - otherwise we fallback - * + Visualization: + Off : No Visialization - * + WhenNoVideo: Overwrites Blank and Picture - * + On : Overwrites Blank, Picture and Video + * + Visualization: + Off : No visualization + * + WhenNoVideo: Overwrites blank and picture + * + On : Overwrites blank, picture and video *} {* * set background to: video *} - VideoLoaded := False; - fShowVisualization := False; + VideoLoaded := false; + fShowVisualization := false; if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then begin if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then begin - fShowVisualization := False; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; fCurrentVideoPlaybackEngine.Play; - VideoLoaded := True; + VideoLoaded := true; end; end; {* * set background to: picture *} - if (CurrentSong.Background <> '') and (VideoLoaded = False) + if (CurrentSong.Background <> '') and (VideoLoaded = false) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then try Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); @@ -501,7 +497,7 @@ begin *} if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin - fShowVisualization := True; + fShowVisualization := true; fCurrentVideoPlaybackEngine := Visualization; if (fCurrentVideoPlaybackEngine <> nil) then fCurrentVideoPlaybackEngine.Play; @@ -511,9 +507,9 @@ begin * set background to: visualization (Videos are still shown) *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (VideoLoaded = False)) then + (VideoLoaded = false)) then begin - fShowVisualization := True; + fShowVisualization := true; fCurrentVideoPlaybackEngine := Visualization; if (fCurrentVideoPlaybackEngine <> nil) then fCurrentVideoPlaybackEngine.Play; @@ -586,21 +582,21 @@ begin end; end; // case - // Initialize lyrics by filling its queue + // initialize lyrics by filling its queue while (not Lyrics.IsQueueFull) and (Lyrics.LineCounter <= High(Lines[0].Line)) do begin Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]); end; - // Deactivate pause - Paused := False; + // deactivate pause + Paused := false; - // Kill all stars not killed yet (GoldenStarsTwinkle Mod) + // kill all stars not killed yet (goldenstarstwinkle mod) GoldenRec.SentenceChange; - // set Position of Line Bonus - Line Bonus end - // set number of empty sentences for Line Bonus + // set position of line bonus - line bonus end + // set number of empty sentences for line bonus NumEmptySentences := 0; for P := Low(Lines[0].Line) to High(Lines[0].Line) do if Lines[0].Line[P].TotalNotes = 0 then @@ -623,7 +619,7 @@ end; procedure TScreenSing.onHide; begin - // Unload background texture + // background texture if (Tex_Background.TexNum > 0) then begin glDeleteTextures(1, PGLuint(@Tex_Background.TexNum)); @@ -643,7 +639,7 @@ begin Background.Draw; - // set player names (for 2 screens and only Singstar skin) + // set player names (for 2 screens and only singstar skin) if ScreenAct = 1 then begin Text[TextP1].Text := 'P1'; @@ -671,7 +667,6 @@ begin end; // case end; // if - //// // dual screen, part 1 //////////////////////// @@ -687,7 +682,6 @@ begin {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; @@ -702,8 +696,6 @@ begin for T := 0 to 1 do Text[T].X := Text[T].X + 10 * ScreenX; - - // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match CurLyricsTime := LyricsState.GetCurrentTime(); @@ -723,7 +715,7 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; - // Draw Background + // draw background SingDrawBackground; // update and draw movie @@ -755,7 +747,7 @@ begin if (not FadeOut) then begin Finish; - FadeOut := True; + FadeOut := true; FadeTo(@ScreenScore); end; end; @@ -764,10 +756,10 @@ begin // always draw custom items SingDraw; - //GoldenNoteStarsTwinkle + // goldennotestarstwinkle GoldenRec.SpawnRec; - //Draw Scores + // draw scores Scores.Draw; //// @@ -784,24 +776,24 @@ begin Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; - //end of weird + // end of weird Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do Text[T].X := Text[T].X - 10 * ScreenX; - // Draw Pausepopup - // FIXME: this is a workaround that the Static is drawn over the Lyrics, Lines, Scores and Effects + // draw pausepopup + // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects // maybe someone could find a better solution if Paused then begin - Static[StaticPausePopup].Visible := True; + Static[StaticPausePopup].Visible := true; Static[StaticPausePopup].Draw; - Static[StaticPausePopup].Visible := False; + Static[StaticPausePopup].Visible := false; end; - Result := True; + Result := true; end; procedure TScreenSing.Finish; @@ -817,11 +809,11 @@ begin Visualization.Close; // to prevent drawing closed video - VideoLoaded := False; + VideoLoaded := false; - //Kill all Stars and Effects + // kill all stars and effects GoldenRec.KillAll; - + if (Ini.SavePlayback = 1) then begin Log.BenchmarkStart(0); @@ -832,7 +824,7 @@ begin Log.LogBenchmark('Creating files', 0); end; - SetFontItalic(False); + SetFontItalic(false); end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); @@ -871,14 +863,14 @@ begin CurrentPlayer := @Player[PlayerIndex]; CurrentScore := CurrentPlayer.Score + CurrentPlayer.ScoreGolden; - // Line Bonus + // line bonus // points for this line LineScore := CurrentScore - CurrentPlayer.ScoreLast; // determine LinePerfection // Note: the "+2" extra points are a little bonus so the player does not - // have to be that perfect to reach the bonus steps. + // have to be that perfect to reach the bonus steps. LinePerfection := (LineScore + 2) / MaxLineScore; // clamp LinePerfection to range [0..1] @@ -908,7 +900,7 @@ begin Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); end; - // PerfectLineTwinkle (effect), Part 1 + // PerfectLineTwinkle (effect), part 1 if (Ini.EffectSing = 1) then CurrentPlayer.LastSentencePerfect := (LinePerfection >= 1); @@ -916,7 +908,7 @@ begin CurrentPlayer.ScoreLast := CurrentScore; end; - // PerfectLineTwinkle (effect), Part 2 + // PerfectLineTwinkle (effect), part 2 if (Ini.EffectSing = 1) then GoldenRec.SpawnPerfectLineTwinkle; end; @@ -925,14 +917,14 @@ end; // SentenceIndex: index of the new active sentence procedure TScreenSing.OnSentenceChange(SentenceIndex: cardinal); begin - //GoldenStarsTwinkle + // goldenstarstwinkle GoldenRec.SentenceChange; - // Fill lyrics queue and set upper line to the current sentence + // fill lyrics queue and set upper line to the current sentence while (Lyrics.GetUpperLineIndex() < SentenceIndex) or (not Lyrics.IsQueueFull) do begin - // Add the next line to the queue or a dummy if no more lines are available + // add the next line to the queue or a dummy if no more lines are available if (Lyrics.LineCounter <= High(Lines[0].Line)) then Lyrics.AddLine(@Lines[0].Line[Lyrics.LineCounter]) else -- cgit v1.2.3 From 34ae54611d3ef54076794c48ce98bc2a15c47be4 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 15 Feb 2009 22:49:45 +0000 Subject: adjust text size in plugins. #69 on assembla can and will be closed now. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1594 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSingModi.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 892bfe6a..525e06a3 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -686,7 +686,7 @@ begin SetFontStyle(Style and 7); // FIXME: FONTSIZE // used by Hold_The_Line / TeamDuell - SetFontSize(Size * 3); + SetFontSize(Size); SetFontPos (X, Y); glPrint (Language.Translate(String(Text))); end; -- cgit v1.2.3 From 5a9b4134bdc9813ad7337848be7f0bfe91b079f0 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Wed, 25 Feb 2009 23:53:32 +0000 Subject: does this fix the score calculation? git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1606 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b7e6b0ec..da0dc6c9 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -888,7 +888,7 @@ begin // apply line-bonus CurrentPlayer.ScoreLine := CurrentPlayer.ScoreLine + LineBonus * LinePerfection; - CurrentPlayer.ScoreLineInt := Round(CurrentPlayer.ScoreLine / 10) * 10; + CurrentPlayer.ScoreLineInt := Floor(CurrentPlayer.ScoreLine / 10) * 10; // update total score CurrentPlayer.ScoreTotalInt := CurrentPlayer.ScoreInt + -- cgit v1.2.3 From 8f2fc12d58f248a7b548c4919c640500c7a4524d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 28 Feb 2009 20:56:12 +0000 Subject: Some cleanup done moved ScoreFactor to UMusic removed unused field TLines.LyricWidth removed unused field TSong.Category removed some weird and useless code from songloading procedures songloading simplified, commented parts that are difficult to understand some changes to score calculation that assure not more nor less than 10000 Points are gainable. after many tests I could not find any bug in score calculation, at least after these changes. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1610 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 13 +++++++++++-- src/screens/UScreenSingModi.pas | 1 - 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 07113363..d30781fe 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -876,9 +876,8 @@ begin NStart := CurrentNote; Lines[0].Line[CNew].Start := Lines[0].Line[CStart].Note[NStart].Start; Lines[0].Line[CNew].Lyric := ''; - Lines[0].Line[CNew].LyricWidth := 0; Lines[0].Line[CNew].End_ := 0; - Lines[0].Line[CNew].BaseNote := 0; // 0.5.0: we modify it later in this procedure + Lines[0].Line[CNew].BaseNote := 0;//High(Integer); // TODO: High (Integer) will causes a memory exception later in this procedure. Weird! Lines[0].Line[CNew].HighNote := -1; SetLength(Lines[0].Line[CNew].Note, 0); @@ -905,6 +904,16 @@ begin Lines[0].Line[CStart].Note[NStart-1].Length; SetLength(Lines[0].Line[CStart].Note, Lines[0].Line[CStart].HighNote + 1); + //recalculate BaseNote of the divided Sentence + with Lines[0].Line[CStart] do + begin + BaseNote := High(Integer); + + For N := 0 to HighNote do + if Note[N].Tone < BaseNote then + BaseNote := Note[N].Tone; + end; + Lines[0].Current := Lines[0].Current + 1; CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 525e06a3..75c7195e 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -167,7 +167,6 @@ begin Result.Sentence[I].Start := Lines.Line[I].Start; Result.Sentence[I].StartNote := Lines.Line[I].Note[0].Start; Result.Sentence[I].Lyric := Lines.Line[I].Lyric; - Result.Sentence[I].LyricWidth := Lines.Line[I].LyricWidth; Result.Sentence[I].End_ := Lines.Line[I].End_; Result.Sentence[I].BaseNote := Lines.Line[I].BaseNote; Result.Sentence[I].HighNote := Lines.Line[I].HighNote; -- cgit v1.2.3 From f57b5a260d4d98a910f62316efe653a1a7e704b7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 1 Mar 2009 12:53:55 +0000 Subject: fixed first screen was cleared when second screen was drawn. #76 should be fixed now commented some weird stuff in TScreenSing.Draw git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1613 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index da0dc6c9..4e977d66 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -636,7 +636,6 @@ var T: integer; CurLyricsTime: real; begin - Background.Draw; // set player names (for 2 screens and only singstar skin) @@ -675,26 +674,26 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff. Commenting this stuff out, nothing // was missing on screen w/ 6 players - so do we even need this stuff? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; + Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + {Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; + Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff + { + Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; } - Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; + { for T := 0 to 1 do + Text[T].X := Text[T].X + 10 * ScreenX; } // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match @@ -770,7 +769,7 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; @@ -781,7 +780,7 @@ begin Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; + Text[T].X := Text[T].X - 10 * ScreenX; } // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects -- cgit v1.2.3 From abad1ccb65dcd39e4fa8bab0c06de982ee842f94 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 1 Mar 2009 15:15:16 +0000 Subject: crashes in ScreenScore w/ 6 players fixed some displaying issues w/ more then 3 players fixed some texts and textures are still not correctly displayed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1614 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 64 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 58 insertions(+), 6 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index ee94d345..cf1cdfc2 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -395,9 +395,9 @@ function TScreenScore.Draw: boolean; var CurrentTime : Cardinal; PlayerCounter : integer; + PStart: Integer; + PHigh: Integer; begin - - inherited Draw; {* player[0].ScoreInt := 7000; player[0].ScoreLineInt := 2000; @@ -409,13 +409,38 @@ begin player[1].ScoreGoldenInt := 900; player[1].ScoreTotalInt := 4500; *} + + //Draw the Background + DrawBG; + + //Calculate first and last Player on this Screen + If (PlayersPlay > 3) then + begin + Case PlayersPlay of + 4: begin + PStart := 1 + ((ScreenAct-1) * 2); + PHigh := 2 + ((ScreenAct-1) * 2); + end; + + 6: begin + PStart := 1 + ((ScreenAct-1) * 3); + PHigh := 3 + ((ScreenAct-1) * 3); + end; + end; + end + Else + begin + PStart := 1; + PHigh := PlayersPlay; + end; + // Let's start to arise the bars CurrentTime := SDL_GetTicks(); if((CurrentTime >= BarTime) AND ShowFinish) then begin BarTime := CurrentTime + BarRaiseSpeed; - for PlayerCounter := 1 to PlayersPlay do + for PlayerCounter := PStart to PHigh do begin // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then @@ -449,11 +474,26 @@ begin EaseScoreIn(PlayerCounter,'Note'); - FillPlayerItems(PlayerCounter,'Funky'); + If (PlayersPlay <= 3) then + //If we play w/ 3 or less players they fit in one screen + //so we don't have to swap the values of themeobjects + //on every draw + FillPlayerItems(PlayerCounter,'Funky'); end; end; + If (PlayersPlay > 3) then + //more then 3 players don't fit the screen + //so we have to swap the themeobjects values on every draw + For PlayerCounter := PStart to PHigh do + begin + FillPlayerItems(PlayerCounter,'Funky'); + end; + + //Draw Theme Objects + DrawFG; + (* //todo: i need a clever method to draw statics with their z value @@ -474,7 +514,13 @@ begin Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; // end todo - ThemeIndex := PlayerNumber + ArrayStartModifier; + // We have to do this here because we use the same Theme Object + // for players on the first and second screen + Case PlayersPlay of + 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; + 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; + 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; + end; //golden Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); @@ -518,7 +564,13 @@ var ThemeIndex : integer; begin - ThemeIndex := PlayerNumber + ArrayStartModifier; + // We have to do this here because we use the same Theme Object + // for players on the first and second screen + Case PlayersPlay of + 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; + 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; + 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; + end; case (Player[PlayerNumber-1].ScoreTotalInt) of 0..2009: -- cgit v1.2.3 From b722e47aeaa7c2909540265556f25f0b8ed59f05 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 1 Mar 2009 23:59:23 +0000 Subject: Cosmetics git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1615 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 269 ++++++++++++++++++++----------------------- 1 file changed, 128 insertions(+), 141 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index cf1cdfc2..6e6d77c7 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -46,56 +46,56 @@ uses UTexture; const - ZBars : real = 0.8; // Z value for the bars - ZRatingPic : real = 0.8; // Z value for the rating pictures + ZBars: real = 0.8; // Z value for the bars + ZRatingPic: real = 0.8; // Z value for the rating pictures - EaseOut_MaxSteps : real = 10; // that's the speed of the bars (10 is fast | 100 is slower) + EaseOut_MaxSteps: real = 10; // that's the speed of the bars (10 is fast | 100 is slower) - BarRaiseSpeed : cardinal = 0; // Time for raising the bar one step higher (in ms) + BarRaiseSpeed: cardinal = 0; // Time for raising the bar one step higher (in ms) type TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players //Bar textures - Score_NoteBarLevel_Dark : TTexture; // Note - Score_NoteBarRound_Dark : TTexture; // that's the round thing on top + Score_NoteBarLevel_Dark: TTexture; // Note + Score_NoteBarRound_Dark: TTexture; // that's the round thing on top - Score_NoteBarLevel_Light : TTexture; // LineBonus | Phrasebonus - Score_NoteBarRound_Light : TTexture; + Score_NoteBarLevel_Light: TTexture; // LineBonus | Phrasebonus + Score_NoteBarRound_Light: TTexture; - Score_NoteBarLevel_Lightest : TTexture; // GoldenNotes - Score_NoteBarRound_Lightest : TTexture; + Score_NoteBarLevel_Lightest: TTexture; // GoldenNotes + Score_NoteBarRound_Lightest: TTexture; end; TPlayerScoreScreenData = record // holds the positions and other data - Bar_Y :Real; - Bar_Actual_Height : Real; // this one holds the actual height of the bar, while we animate it - BarScore_ActualHeight : Real; - BarLine_ActualHeight : Real; - BarGolden_ActualHeight : Real; + Bar_Y: real; + Bar_Actual_Height: real; // this one holds the actual height of the bar, while we animate it + BarScore_ActualHeight: real; + BarLine_ActualHeight: real; + BarGolden_ActualHeight: real; end; TPlayerScoreRatingPics = record // a fine array of the rating pictures - RateEaseStep : Integer; - RateEaseValue: Real; + RateEaseStep: integer; + RateEaseValue: real; end; TScreenScore = class(TMenu) private - BarTime : Cardinal; - ArrayStartModifier : integer; + BarTime: cardinal; + ArrayStartModifier: integer; public - aPlayerScoreScreenTextures : array[1..6] of TPlayerScoreScreenTexture; - aPlayerScoreScreenDatas : array[1..6] of TPlayerScoreScreenData; - aPlayerScoreScreenRatings : array[1..6] of TPlayerScoreRatingPics; + aPlayerScoreScreenTextures: array[1..6] of TPlayerScoreScreenTexture; + aPlayerScoreScreenDatas: array[1..6] of TPlayerScoreScreenData; + aPlayerScoreScreenRatings: array[1..6] of TPlayerScoreRatingPics; - BarScore_EaseOut_Step : real; - BarPhrase_EaseOut_Step : real; - BarGolden_EaseOut_Step : real; + BarScore_EaseOut_Step: real; + BarPhrase_EaseOut_Step: real; + BarGolden_EaseOut_Step: real; - TextArtist: integer; - TextTitle: integer; + TextArtist: integer; + TextTitle: integer; - TextArtistTitle : integer; + TextArtistTitle: integer; TextName: array[1..6] of integer; TextScore: array[1..6] of integer; @@ -110,63 +110,60 @@ type TextTotalScore: array[1..6] of integer; PlayerStatic: array[1..6] of array of integer; - PlayerTexts : array[1..6] of array of integer; - + PlayerTexts: array[1..6] of array of integer; StaticBoxLightest: array[1..6] of integer; StaticBoxLight: array[1..6] of integer; StaticBoxDark: array[1..6] of integer; - StaticBackLevel: array[1..6] of integer; - StaticBackLevelRound: array[1..6] of integer; - StaticLevel: array[1..6] of integer; - StaticLevelRound: array[1..6] of integer; - - Animation: real; - - TextScore_ActualValue : array[1..6] of integer; - TextPhrase_ActualValue : array[1..6] of integer; - TextGolden_ActualValue : array[1..6] of integer; + StaticBackLevel: array[1..6] of integer; + StaticBackLevelRound: array[1..6] of integer; + StaticLevel: array[1..6] of integer; + StaticLevelRound: array[1..6] of integer; + Animation: real; + TextScore_ActualValue: array[1..6] of integer; + TextPhrase_ActualValue: array[1..6] of integer; + TextGolden_ActualValue: array[1..6] of integer; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure onShowFinish; override; function Draw: boolean; override; procedure FillPlayer(Item, P: integer); - procedure EaseBarIn(PlayerNumber : Integer; BarType: String); - procedure EaseScoreIn(PlayerNumber : Integer; ScoreType: String); + procedure EaseBarIn(PlayerNumber: integer; BarType: string); + procedure EaseScoreIn(PlayerNumber: integer; ScoreType: string); - procedure FillPlayerItems(PlayerNumber : Integer; ScoreType: String); + procedure FillPlayerItems(PlayerNumber: integer; ScoreType: string); - - procedure DrawBar(BarType:string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); + procedure DrawBar(BarType: string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); //Rating Picture procedure ShowRating(PlayerNumber: integer); - function CalculateBouncing(PlayerNumber : Integer): real; - procedure DrawRating(PlayerNumber:integer;Rating:integer); + function CalculateBouncing(PlayerNumber: integer): real; + procedure DrawRating(PlayerNumber: integer; Rating: integer); end; implementation - -uses UGraphic, - UScreenSong, - UMenuStatic, - UTime, - UMain, - UIni, - ULog, - ULanguage; - -function TScreenScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UScreenSong, + UMenuStatic, + UTime, + UMain, + UIni, + ULog, + ULanguage; + +function TScreenScore.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then begin + if (PressedDown) then + begin // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': @@ -256,9 +253,9 @@ end; procedure TScreenScore.onShow; var - P: integer; // player - I: integer; - V: array[1..6] of boolean; // visibility array + P: integer; // player + I: integer; + V: array[1..6] of boolean; // visibility array begin @@ -295,7 +292,6 @@ begin aPlayerScoreScreenRatings[P].RateEaseValue := 20; end; - Text[TextArtist].Text := CurrentSong.Artist; Text[TextTitle].Text := CurrentSong.Title; Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; @@ -347,7 +343,6 @@ begin Static[StaticBoxLight[P]].Texture.Alpha := 0; Static[StaticBoxDark[P]].Texture.Alpha := 0; - Text[TextNotes[P]].Visible := V[P]; Text[TextNotesScore[P]].Visible := V[P]; Text[TextLineBonus[P]].Visible := V[P]; @@ -377,14 +372,14 @@ end; procedure TScreenScore.onShowFinish; var - index : integer; + index: integer; begin for index := 1 to (PlayersPlay) do - begin - TextScore_ActualValue[index] := 0; - TextPhrase_ActualValue[index] := 0; - TextGolden_ActualValue[index] := 0; - end; + begin + TextScore_ActualValue[index] := 0; + TextPhrase_ActualValue[index] := 0; + TextGolden_ActualValue[index] := 0; + end; BarScore_EaseOut_Step := 1; BarPhrase_EaseOut_Step := 1; @@ -393,10 +388,10 @@ end; function TScreenScore.Draw: boolean; var - CurrentTime : Cardinal; - PlayerCounter : integer; - PStart: Integer; - PHigh: Integer; + CurrentTime: cardinal; + PlayerCounter: integer; + PStart: integer; + PHigh: integer; begin {* player[0].ScoreInt := 7000; @@ -414,9 +409,9 @@ begin DrawBG; //Calculate first and last Player on this Screen - If (PlayersPlay > 3) then + if (PlayersPlay > 3) then begin - Case PlayersPlay of + case PlayersPlay of 4: begin PStart := 1 + ((ScreenAct-1) * 2); PHigh := 2 + ((ScreenAct-1) * 2); @@ -428,7 +423,7 @@ begin end; end; end - Else + else begin PStart := 1; PHigh := PlayersPlay; @@ -436,7 +431,7 @@ begin // Let's start to arise the bars CurrentTime := SDL_GetTicks(); - if((CurrentTime >= BarTime) AND ShowFinish) then + if((CurrentTime >= BarTime) and ShowFinish) then begin BarTime := CurrentTime + BarRaiseSpeed; @@ -452,7 +447,6 @@ begin if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; - // GoldenNotebonus if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then begin @@ -473,20 +467,19 @@ begin EaseBarIn(PlayerCounter, 'Note'); EaseScoreIn(PlayerCounter,'Note'); - - If (PlayersPlay <= 3) then + if (PlayersPlay <= 3) then //If we play w/ 3 or less players they fit in one screen //so we don't have to swap the values of themeobjects - //on every draw + //on every draw FillPlayerItems(PlayerCounter,'Funky'); end; end; - If (PlayersPlay > 3) then + if (PlayersPlay > 3) then //more then 3 players don't fit the screen //so we have to swap the themeobjects values on every draw - For PlayerCounter := PStart to PHigh do + for PlayerCounter := PStart to PHigh do begin FillPlayerItems(PlayerCounter,'Funky'); end; @@ -494,7 +487,6 @@ begin //Draw Theme Objects DrawFG; - (* //todo: i need a clever method to draw statics with their z value for I := 0 to Length(Static) - 1 do @@ -506,7 +498,7 @@ begin Result := true; end; -procedure TscreenScore.FillPlayerItems(PlayerNumber : Integer; ScoreType: String); +procedure TscreenScore.FillPlayerItems(PlayerNumber: integer; ScoreType: string); var ThemeIndex: integer; begin @@ -516,11 +508,11 @@ begin // We have to do this here because we use the same Theme Object // for players on the first and second screen - Case PlayersPlay of + case PlayersPlay of 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; - end; + end; //golden Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); @@ -557,20 +549,19 @@ begin end; end; - procedure TScreenScore.ShowRating(PlayerNumber: integer); var - Rating : integer; - ThemeIndex : integer; + Rating: integer; + ThemeIndex: integer; begin // We have to do this here because we use the same Theme Object // for players on the first and second screen - Case PlayersPlay of + case PlayersPlay of 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; - end; + end; case (Player[PlayerNumber-1].ScoreTotalInt) of 0..2009: @@ -618,7 +609,7 @@ begin end; //todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings - if ( Theme.Score.StaticRatings[ThemeIndex].W > 0 ) AND ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + if ( Theme.Score.StaticRatings[ThemeIndex].W > 0 ) and ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then begin Text[TextScore[ThemeIndex]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / Theme.Score.StaticRatings[ThemeIndex].W; end; @@ -627,11 +618,11 @@ begin DrawRating(PlayerNumber, Rating); end; -procedure TscreenScore.DrawRating(PlayerNumber:integer;Rating:integer); +procedure TscreenScore.DrawRating(PlayerNumber: integer; Rating: integer); var - Posx : real; - Posy : real; - Width :real; + Posx: real; + Posy: real; + Width: real; begin CalculateBouncing(PlayerNumber); @@ -658,56 +649,53 @@ begin glDisable(GL_TEXTURE_2d); end; - - -function TscreenScore.CalculateBouncing(PlayerNumber : Integer): real; +function TscreenScore.CalculateBouncing(PlayerNumber: integer): real; var - ReturnValue : real; - p, s : real; + ReturnValue: real; + p, s: real; - RaiseStep, MaxVal : real; - EaseOut_Step : integer; + RaiseStep, MaxVal: real; + EaseOut_Step: integer; begin EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; MaxVal := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].W; RaiseStep := EaseOut_Step; - if (MaxVal > 0) AND (RaiseStep > 0) then + if (MaxVal > 0) and (RaiseStep > 0) then RaiseStep := RaiseStep / MaxVal; - if (RaiseStep = 1) then - begin - ReturnValue := MaxVal; - end - else - begin - p := MaxVal * 0.4; + if (RaiseStep = 1) then + begin + ReturnValue := MaxVal; + end + else + begin + p := MaxVal * 0.4; - s := p/(2*PI) * arcsin (1); - ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + s := p/(2*PI) * arcsin (1); + ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; - inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); - aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; - end; + inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + end; Result := ReturnValue; end; - -procedure TscreenScore.EaseBarIn(PlayerNumber : Integer; BarType: String); +procedure TscreenScore.EaseBarIn(PlayerNumber: integer; BarType: string); const - RaiseSmoothness : integer = 100; + RaiseSmoothness: integer = 100; var - MaxHeight : real; - NewHeight : real; + MaxHeight: real; + NewHeight: real; - Height2Reach : real; - RaiseStep : real; - BarStartPosY : single; + Height2Reach: real; + RaiseStep: real; + BarStartPosY: single; - lTmp : real; - Score : integer; + lTmp: real; + Score: integer; begin MaxHeight := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].H; @@ -768,10 +756,10 @@ begin aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight; end; -procedure TscreenScore.DrawBar(BarType:string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); +procedure TscreenScore.DrawBar(BarType: string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); var - Width:real; - BarStartPosX:real; + Width: real; + BarStartPosX: real; begin // this is solely for better readability of the drawing Width := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].W; @@ -825,15 +813,15 @@ begin glDisable(GL_TEXTURE_2d); end; -procedure TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType : String); +procedure TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType: string); const - RaiseSmoothness : integer = 100; + RaiseSmoothness: integer = 100; var - RaiseStep : Real; - lTmpA : Real; - ScoreReached :Integer; - EaseOut_Step :Real; - ActualScoreValue:integer; + RaiseStep: real; + lTmpA: real; + ScoreReached: integer; + EaseOut_Step: real; + ActualScoreValue: integer; begin if (ScoreType = 'Note') then begin @@ -865,7 +853,7 @@ begin // quadratic easing out - decelerating to zero velocity // -end_position * current_time * ( current_time - 2 ) + start_postion lTmpA := (-ScoreReached * RaiseStep * (RaiseStep - 20)); - if ( lTmpA > 0 ) AND + if ( lTmpA > 0 ) and ( RaiseSmoothness > 0 ) then begin if (ScoreType = 'Note') then @@ -919,7 +907,6 @@ begin Text[TextGoldenNotesScore[Item]].Text := S; //end of fix - end; end. -- cgit v1.2.3 From 9be9439fce30028c619a401523793ec101dccaed Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Fri, 6 Mar 2009 23:45:10 +0000 Subject: Clear Scores moved to UScreenSing and inlined. Reduce clutter in UMain git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1624 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 4e977d66..f232bdc1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -305,7 +305,7 @@ end; procedure TScreenSing.onShow; var - P: integer; + Index: integer; V1: boolean; V1TwoP: boolean; // position of score box in two player mode V1ThreeP: boolean; // position of score box in three player mode @@ -331,9 +331,9 @@ begin Color.B := 0; // dummy atm <- \(O.o)/? B like bummy? // add new players - for P := 0 to PlayersPlay - 1 do + for Index := 0 to PlayersPlay - 1 do begin - Scores.AddPlayer(Tex_ScoreBG[P], Color); + Scores.AddPlayer(Tex_ScoreBG[Index], Color); end; Scores.Init; // get positions for players @@ -534,8 +534,24 @@ begin // prepare and start voice-capture AudioInput.CaptureStart; - for P := 0 to High(Player) do - ClearScores(P); + // clear the scores of all players + + for Index := 0 to High(Player) do + with Player[Index] do + begin + Score := 0; + ScoreLine := 0; + ScoreGolden := 0; + + ScoreInt := 0; + ScoreLineInt := 0; + ScoreGoldenInt := 0; + ScoreTotalInt := 0; + + ScoreLast := 0; + + LastSentencePerfect := false; + end; // main text Lyrics.Clear(CurrentSong.BPM[0].BPM, CurrentSong.Resolution); @@ -598,8 +614,8 @@ begin // set position of line bonus - line bonus end // set number of empty sentences for line bonus NumEmptySentences := 0; - for P := Low(Lines[0].Line) to High(Lines[0].Line) do - if Lines[0].Line[P].TotalNotes = 0 then + for Index := Low(Lines[0].Line) to High(Lines[0].Line) do + if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); Log.LogStatus('End', 'onShow'); -- cgit v1.2.3 From 458111738476004a914af6fd3e117eb84a35ab6a Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 01:06:07 +0000 Subject: unclutter UMain.pas. Create UPath.pas. Tests on all platformssvn statussvn status git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1625 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 22 +++++++++++----------- src/screens/UScreenEditConvert.pas | 9 +++++---- src/screens/UScreenOptionsThemes.pas | 10 ++++++---- src/screens/UScreenSingModi.pas | 14 +++++++++++++- 4 files changed, 35 insertions(+), 20 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 6d410a97..6e5c5ba7 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -34,6 +34,7 @@ interface {$I switches.inc} uses + SysUtils, UMenu, SDL, SDL_Image, @@ -42,7 +43,6 @@ uses gl, UMusic, UFiles, - SysUtils, UThemes, UGraphicClasses; @@ -167,16 +167,16 @@ const implementation uses - ULog, - UGraphic, - UMain, - UIni, - USongs, - Textgl, - ULanguage, - UCommon, - Math; - + Math, + ULog, + UGraphic, + UMain, + UIni, + USongs, + Textgl, + ULanguage, + UCommon, + UPath; function TScreenCredits.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 56afdefd..8ef43770 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -119,14 +119,15 @@ type implementation uses - UGraphic, SysUtils, - UDrawTexture, TextGL, + gl, + UDrawTexture, UFiles, - UMain, + UGraphic, UIni, - gl, + UMain, + UPath, USkins; function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index ec6fe014..4970de21 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -57,10 +57,12 @@ type implementation -uses UMain, - UGraphic, - USkins, - SysUtils; +uses + SysUtils, + UGraphic, + UMain, + UPath, + USkins; function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; begin diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 75c7195e..9c48104e 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -119,7 +119,19 @@ procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sou function ToSentences(Const Lines: TLines): TSentences; implementation -uses UGraphic, UDraw, UMain, Classes, URecord, ULanguage, math, UDLLManager, USkins, UGraphicClasses; + +uses + Classes, + Math, + UDLLManager, + UDraw, + UGraphic, + UGraphicClasses, + ULanguage, + UMain, + UPath, + URecord, + USkins; // Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; -- cgit v1.2.3 From b38fa5a07ab1f5604372176c8e84ddfb075133ee Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 19:53:00 +0000 Subject: unclutter Umain: ConversionFileName moved to UScreenEditConvert git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1626 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditConvert.pas | 3 +++ src/screens/UScreenOpen.pas | 1 + 2 files changed, 4 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 8ef43770..89fd64c5 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -116,6 +116,9 @@ type procedure onHide; override; end; +var + ConversionFileName: string; + implementation uses diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index c4d773e7..fe9f0664 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -74,6 +74,7 @@ uses UGraphic, UDraw, UMain, + UScreenEditConvert, USkins; function TScreenOpen.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; -- cgit v1.2.3 From f469075a0335399c753ae5d2d362047dedf116b1 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 7 Mar 2009 21:14:14 +0000 Subject: final cleanup of Umain. Creation of UNote git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1627 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 2 +- src/screens/UScreenMain.pas | 2 +- src/screens/UScreenName.pas | 15 +- src/screens/UScreenScore.pas | 4 +- src/screens/UScreenSing.pas | 33 ++-- src/screens/UScreenSingModi.pas | 2 +- src/screens/UScreenSong.pas | 347 ++++++++++++++++++++++------------------ src/screens/UScreenTop5.pas | 96 ++++++----- 8 files changed, 289 insertions(+), 212 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index d30781fe..bdf85028 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -128,7 +128,7 @@ implementation uses UGraphic, UDraw, - UMain, + UNote, USkins, ULanguage; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 2a2d0613..4980021e 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -63,7 +63,7 @@ implementation uses UGraphic, - UMain, + UNote, UIni, UTexture, USongs, diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index dd11b882..055f644e 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + SysUtils, + SDL, + UDisplay, + UFiles, + UMenu, + UMusic, + UThemes; type TScreenName = class(TMenu) @@ -48,7 +54,12 @@ type implementation -uses UGraphic, UMain, UIni, UTexture, UCommon; +uses + UCommon, + UGraphic, + UIni, + UNote, + UTexture; function TScreenName.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 6e6d77c7..f3f888b3 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -154,10 +154,10 @@ uses UScreenSong, UMenuStatic, UTime, - UMain, UIni, ULog, - ULanguage; + ULanguage, + UNote; function TScreenScore.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index f232bdc1..fcf448a9 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -33,22 +33,23 @@ interface {$I switches.inc} -uses UMenu, - UMusic, - SDL, +uses SysUtils, + gl, + SDL, + TextGL, UFiles, - UTime, - USongs, + UGraphicClasses, UIni, ULog, - UTexture, ULyrics, - TextGL, - gl, + UMenu, + UMusic, + USingScores, + USongs, + UTexture, UThemes, - UGraphicClasses, - USingScores; + UTime; type TLyricsSyncSource = class(TSyncSource) @@ -119,14 +120,14 @@ type implementation uses - UGraphic, - UDraw, - UMain, - USong, Classes, - URecord, + Math, + UDraw, + UGraphic, ULanguage, - Math; + UNote, + URecord, + USong; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 9c48104e..4ead8e55 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -128,7 +128,7 @@ uses UGraphic, UGraphicClasses, ULanguage, - UMain, + UNote, UPath, URecord, USkins; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 28358353..8aa5acca 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -65,7 +65,7 @@ type TextNumber: integer; //Video Icon Mod - VideoIcon: Cardinal; + VideoIcon: cardinal; TextCat: integer; StaticCat: integer; @@ -88,28 +88,28 @@ type Mode: TSingMode; //party Statics (Joker) - StaticTeam1Joker1: Cardinal; - StaticTeam1Joker2: Cardinal; - StaticTeam1Joker3: Cardinal; - StaticTeam1Joker4: Cardinal; - StaticTeam1Joker5: Cardinal; - - StaticTeam2Joker1: Cardinal; - StaticTeam2Joker2: Cardinal; - StaticTeam2Joker3: Cardinal; - StaticTeam2Joker4: Cardinal; - StaticTeam2Joker5: Cardinal; - - StaticTeam3Joker1: Cardinal; - StaticTeam3Joker2: Cardinal; - StaticTeam3Joker3: Cardinal; - StaticTeam3Joker4: Cardinal; - StaticTeam3Joker5: Cardinal; - - StaticParty: array of Cardinal; - TextParty: array of Cardinal; - StaticNonParty: array of Cardinal; - TextNonParty: array of Cardinal; + 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; @@ -120,18 +120,18 @@ type procedure SetScroll4; procedure SetScroll5; procedure SetScroll6; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); procedure onShow; override; procedure onHide; override; procedure SelectNext; procedure SelectPrev; - procedure SkipTo(Target: Cardinal); + 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 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 ChangeMusic; @@ -154,23 +154,25 @@ type implementation uses - UGraphic, - UMain, - UCovers, - math, + Math, gl, - USkins, + UCovers, UDLLManager, + UGraphic, + UMain, + UMenuButton, + UNote, UParty, UPlaylist, - UMenuButton, - UScreenSongMenu; + UScreenSongMenu, + USkins; // ***** Public methods ****** // //Show Wrong Song when Tabs on Fix procedure TScreenSong.FixSelected; -var I, I2: Integer; +var + I, I2: integer; begin if CatSongs.VisibleSongs > 0 then begin @@ -190,7 +192,8 @@ begin end; procedure TScreenSong.FixSelected2; -var I, I2: Integer; +var + I, I2: integer; begin if CatSongs.VisibleSongs > 0 then begin @@ -209,15 +212,15 @@ begin end; //Show Wrong Song when Tabs on Fix End -procedure TScreenSong.ShowCatTLCustom(Caption: String);// Show Custom Text in Top left +procedure TScreenSong.ShowCatTLCustom(Caption: string);// Show Custom Text in Top left begin Text[TextCat].Text := Caption; Text[TextCat].Visible := true; - Static[StaticCat].Visible := False; + Static[StaticCat].Visible := false; end; //Show Cat in Top Left Mod -procedure TScreenSong.ShowCatTL(Cat: Integer); +procedure TScreenSong.ShowCatTL(Cat: integer); begin //Change Text[TextCat].Text := CatSongs.Song[Cat].Artist; @@ -225,7 +228,7 @@ begin //Show Text[TextCat].Visible := true; - Static[StaticCat].Visible := True; + Static[StaticCat].Visible := true; end; procedure TScreenSong.HideCatTL; @@ -234,7 +237,7 @@ begin //Text[TextCat].Visible := false; Static[StaticCat].Visible := false; //New -> Show Text specified in Theme - Text[TextCat].Visible := True; + Text[TextCat].Visible := true; Text[TextCat].Text := Theme.Song.TextCat.Text; end; //Show Cat in Top Left Mod End @@ -242,7 +245,7 @@ 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; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var I: integer; I2: integer; @@ -379,7 +382,7 @@ begin begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - ScreenSongJumpto.Visible := True; + ScreenSongJumpto.Visible := true; end; Exit; end; @@ -451,7 +454,8 @@ begin SelectNext; //Fix: Not Existing Song selected: - //if (I+1=I2) then Inc(I2); + //if (I+1=I2) then + Inc(I2); //Choose Song SkipTo(I2-I); @@ -505,7 +509,7 @@ begin SelectNext; FixSelected; //SelectPrev; - //CatSongs.Song[0].Visible := False; + //CatSongs.Song[0].Visible := false; end else begin @@ -605,7 +609,8 @@ begin if Ini.TabsAtStartup = 1 then begin I := Interaction; - if I <= 0 then I := 1; + if I <= 0 then + I := 1; while not catsongs.Song[I].Main do begin @@ -646,7 +651,8 @@ begin begin I := Interaction; I2 := 0; - if I <= 0 then I := 1; + if I <= 0 then + I := 1; while not catsongs.Song[I].Main or (I2 = 0) do begin @@ -808,7 +814,7 @@ end; procedure TScreenSong.GenerateThumbnails(); var - I: Integer; + I: integer; CoverButtonIndex: integer; CoverButton: TButton; CoverName: string; @@ -869,7 +875,7 @@ end; procedure TScreenSong.SetScroll; var - VS, B: Integer; + VS, B: integer; begin VS := CatSongs.VisibleSongs; if VS > 0 then @@ -913,7 +919,7 @@ begin Text[TextArtist].Text := ''; Text[TextTitle].Text := ''; for B := 0 to High(Button) do - Button[B].Visible := False; + Button[B].Visible := false; end; end; @@ -943,29 +949,37 @@ begin VisCount := 0; for B := 0 to High(Button) do - if CatSongs.Song[B].Visible then Inc(VisCount); + 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 CatSongs.Song[B].Visible then + Inc(VisInt); - if VisCount <= 6 then begin + if VisCount <= 6 then + begin Typ := 0; - end else begin - if VisInt <= 3 then begin + end + else + begin + if VisInt <= 3 then + begin Typ := 1; Count := 7; Ready := true; end; - if (VisCount - VisInt) <= 3 then begin + if (VisCount - VisInt) <= 3 then + begin Typ := 2; Count := 7; Ready := true; end; - if not Ready then begin + if not Ready then + begin Typ := 3; Src := Interaction; end; @@ -974,13 +988,15 @@ begin // hide all buttons - for B := 0 to High(Button) do begin + 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 + for B := Src to Dst do + begin //Button[B].Visible := true; Button[B].Visible := CatSongs.Song[B].Visible; Button[B].Selectable := Button[B].Visible; @@ -989,9 +1005,12 @@ begin } - if Typ = 0 then begin - for B := 0 to High(Button) do begin - if CatSongs.Song[B].Visible then begin + 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); @@ -999,10 +1018,13 @@ begin end; end; - if Typ = 1 then begin + if Typ = 1 then + begin B := 0; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin + while (Count > 0) do + begin + if CatSongs.Song[B].Visible then + begin Button[B].Visible := true; Button[B].Y := 140 + (Placed) * 60; Inc(Placed); @@ -1012,10 +1034,13 @@ begin end; end; - if Typ = 2 then begin + if Typ = 2 then + begin B := High(Button); - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin + 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); @@ -1025,11 +1050,14 @@ begin end; end; - if Typ = 3 then begin + if Typ = 3 then + begin B := Src; Count := 4; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin + 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); @@ -1041,8 +1069,10 @@ begin B := Src-1; Placed := 0; Count := 3; - while (Count > 0) do begin - if CatSongs.Song[B].Visible then begin + 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); @@ -1067,7 +1097,8 @@ begin for B := 0 to High(Button) do Button[B].X := 300 + (B - Interaction) * 260; - if Length(Button) >= 3 then begin + if Length(Button) >= 3 then + begin if Interaction = 0 then Button[High(Button)].X := 300 - 260; @@ -1077,7 +1108,8 @@ begin // circle { - for B := 0 to High(Button) do begin + for B := 0 to High(Button) do + begin Factor := (B - Interaction); // 0 to center, -1: to left, +1 to right Factor2 := Factor / Length(Button); Button[B].X := 300 + 10000 * sin(2*pi*Factor2); @@ -1100,13 +1132,14 @@ begin 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 + Button[B].Visible := false else - Button[B].Visible := True; + Button[B].Visible := true; end; { - if Length(Button) >= 3 then begin + if Length(Button) >= 3 then + begin if Interaction = 0 then Button[High(Button)].X := 300 - 260; @@ -1117,7 +1150,8 @@ begin // circle { - for B := 0 to High(Button) do begin + for B := 0 to High(Button) do + begin Factor := (B - Interaction); // 0 to center, -1: to left, +1 to right Factor2 := Factor / Length(Button); Button[B].X := 300 + 10000 * sin(2*pi*Factor2); @@ -1174,10 +1208,10 @@ procedure TScreenSong.SetScroll5; var B: integer; Angle: real; - Pos: Real; + Pos: real; VS: integer; Padding: real; - X: Real; + X: real; { Theme.Song.CoverW: circle radius Theme.Song.CoverX: x-pos. of the left edge of the selected cover @@ -1249,13 +1283,13 @@ end; procedure TScreenSong.SetScroll6; // rotate (slotmachine style) var B: integer; - Angle: real; - Pos: Real; + Angle: real; + Pos: real; VS: integer; - diff: real; - X: Real; - Factor: real; - Z, Z2: real; + diff: real; + X: real; + Factor: real; + Z, Z2: real; begin VS := CatSongs.VisibleSongs; if VS <= 5 then @@ -1264,22 +1298,23 @@ begin for B := 0 to High(Button) do begin Button[B].Visible := CatSongs.Song[B].Visible; - if Button[B].Visible then begin // optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed - - Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + if Button[B].Visible then // optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed + begin + + Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - Z := (1 + cos(Factor)) / 2; - Z2 := (1 + 2*Z) / 3; + Z := (1 + cos(Factor)) / 2; + Z2 := (1 + 2*Z) / 3; - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * 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].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * 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].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; + //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 @@ -1287,10 +1322,10 @@ begin begin //Change Pos of all Buttons for B := low(Button) to high(Button) do - begin - Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility + begin + Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility if Button[B].Visible then //Only Change Pos for Visible Buttons - begin + begin Pos := (CatSongs.VisibleIndex(B) - SongCurrent); if (Pos < -VS/2) then Pos := Pos + VS @@ -1300,7 +1335,7 @@ begin if (Abs(Pos) < 2.5) then {fixed Positions} begin Angle := Pi * (Pos / 5); - //Button[B].Visible := False; + //Button[B].Visible := false; Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8));//Power(Z2, 3); @@ -1323,8 +1358,10 @@ begin begin {Behind the Front Covers} // limit-bg-covers hack - if (abs(VS/2-abs(Pos))>10) then Button[B].Visible:=False; - if VS > 25 then VS:=25; + 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 @@ -1442,9 +1479,9 @@ end; function TScreenSong.Draw: boolean; var - dx: real; - dt: real; - I: Integer; + dx: real; + dt: real; + I: integer; begin dx := SongTarget-SongCurrent; dt := TimeSkip * 7; @@ -1455,7 +1492,8 @@ begin SongCurrent := SongCurrent + dx*dt; { - if SongCurrent > Catsongs.VisibleSongs then begin + if SongCurrent > Catsongs.VisibleSongs then + begin SongCurrent := SongCurrent - Catsongs.VisibleSongs; SongTarget := SongTarget - Catsongs.VisibleSongs; end; @@ -1521,8 +1559,8 @@ end; procedure TScreenSong.SelectNext; var - Skip: integer; - VS: Integer; + Skip: integer; + VS: integer; begin VS := CatSongs.VisibleSongs; @@ -1541,7 +1579,8 @@ begin Interaction := (Interaction + Skip) mod Length(Interactions); // try to keep all at the beginning - if SongTarget > VS-1 then begin + if SongTarget > VS-1 then + begin SongTarget := SongTarget - VS; SongCurrent := SongCurrent - VS; end; @@ -1555,8 +1594,8 @@ end; procedure TScreenSong.SelectPrev; var - Skip: integer; - VS: Integer; + Skip: integer; + VS: integer; begin VS := CatSongs.VisibleSongs; @@ -1566,13 +1605,15 @@ begin Skip := 1; - while (not CatSongs.Song[(Interaction - Skip + Length(Interactions)) mod Length(Interactions)].Visible) do Inc(Skip); + 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 + if SongTarget < 0 then + begin SongTarget := SongTarget + CatSongs.VisibleSongs; SongCurrent := SongCurrent + CatSongs.VisibleSongs; end; @@ -1652,9 +1693,9 @@ begin end; end; -procedure TScreenSong.SkipTo(Target: Cardinal); +procedure TScreenSong.SkipTo(Target: cardinal); var - i: integer; + i: integer; begin UnLoadDetailedCover; @@ -1669,7 +1710,7 @@ end; procedure TScreenSong.SelectRandomSong; var - I, I2: Integer; + I, I2: integer; begin case PlaylistMan.Mode of smNormal: //All Songs Just Select Random Song @@ -1748,11 +1789,11 @@ begin end else begin - Static[StaticTeam1Joker1].Visible := False; - Static[StaticTeam1Joker2].Visible := False; - Static[StaticTeam1Joker3].Visible := False; - Static[StaticTeam1Joker4].Visible := False; - Static[StaticTeam1Joker5].Visible := False; + 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 @@ -1765,11 +1806,11 @@ begin end else begin - Static[StaticTeam2Joker1].Visible := False; - Static[StaticTeam2Joker2].Visible := False; - Static[StaticTeam2Joker3].Visible := False; - Static[StaticTeam2Joker4].Visible := False; - Static[StaticTeam2Joker5].Visible := False; + 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 @@ -1782,40 +1823,40 @@ begin end else begin - Static[StaticTeam3Joker1].Visible := False; - Static[StaticTeam3Joker2].Visible := False; - Static[StaticTeam3Joker3].Visible := False; - Static[StaticTeam3Joker4].Visible := False; - Static[StaticTeam3Joker5].Visible := False; + 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; + 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; + I: integer; + Visible: boolean; begin //Set Visibility of Party Statics and Text Visible := (Mode = smPartyMode); @@ -1859,7 +1900,7 @@ begin CatSongs.Selected := Interaction; StopMusicPreview(); - ScreenName.Goto_SingScreen := True; + ScreenName.Goto_SingScreen := true; FadeTo(@ScreenName); end; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 59f5972b..c45f01bf 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -34,34 +34,46 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes; + SysUtils, + SDL, + UDisplay, + UMenu, + UMusic, + USongs, + UThemes; type TScreenTop5 = class(TMenu) public - TextLevel: integer; - TextArtistTitle: integer; + TextLevel: integer; + TextArtistTitle: integer; - StaticNumber: array[1..5] of integer; - TextNumber: array[1..5] of integer; - TextName: array[1..5] of integer; - TextScore: array[1..5] of integer; + StaticNumber: array[1..5] of integer; + TextNumber: array[1..5] of integer; + TextName: array[1..5] of integer; + TextScore: array[1..5] of integer; + + Fadeout: boolean; - Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; function Draw: boolean; override; end; implementation -uses UGraphic, UDataBase, UMain, UIni; +uses + UDataBase, + UGraphic, + UIni, + UNote; -function TScreenTop5.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then begin + if (PressedDown) then + begin // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': @@ -70,14 +82,15 @@ begin Exit; end; end; - + // check special keys case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE, SDLK_RETURN: begin - if (not Fadeout) then begin + if (not Fadeout) then + begin FadeTo(@ScreenSong); Fadeout := true; end; @@ -92,7 +105,7 @@ end; constructor TScreenTop5.Create; var - I: integer; + I: integer; begin inherited Create; @@ -116,8 +129,8 @@ end; procedure TScreenTop5.onShow; var - I: integer; - PMax: integer; + I: integer; + PMax: integer; begin inherited; @@ -126,7 +139,8 @@ begin //ReadScore(CurrentSong); PMax := Ini.Players; - if PMax = 4 then PMax := 5; + if PMax = 4 then + PMax := 5; for I := 0 to PMax do DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); @@ -135,7 +149,8 @@ begin Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; - for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin + for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do + begin Static[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; @@ -145,7 +160,8 @@ begin Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin + for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do + begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; @@ -157,24 +173,30 @@ end; function TScreenTop5.Draw: boolean; //var -{ Min: real; - Max: real; - Factor: real; - Factor2: real; - - Item: integer; - P: integer; - C: integer;} +{ + Min: real; + Max: real; + Factor: real; + Factor2: real; + + Item: integer; + P: integer; + C: integer; +} begin // Singstar - let it be...... with 6 statics -(* if PlayersPlay = 6 then begin - for Item := 4 to 6 do begin +(* + if PlayersPlay = 6 then + begin + for Item := 4 to 6 do + begin if ScreenAct = 1 then P := Item-4; if ScreenAct = 2 then P := Item-1; FillPlayer(Item, P); - -{ if ScreenAct = 1 then begin +{ + if ScreenAct = 1 then + begin LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, @@ -182,16 +204,18 @@ begin 'P1Dark'); end; - if ScreenAct = 2 then begin + if ScreenAct = 2 then + begin LoadColor( Static[StaticBoxLightest[Item]].Texture.ColR, Static[StaticBoxLightest[Item]].Texture.ColG, Static[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); - end; } - + end; +} end; - end; *) + end; +*) Result := inherited Draw; end; -- cgit v1.2.3 From 486feffb21e42c713fa97a157cf860554be66976 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 7 Mar 2009 21:42:17 +0000 Subject: overdrawing of first screen when using visualizations fixed. visualizations are still streched over both screens when UseTexture in UVisualizer is undefined git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1628 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index fcf448a9..ee5164db 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -655,6 +655,12 @@ var begin Background.Draw; + // draw background picture (if any, and if no visualizations) + // when we don't check for visualizations the visualizations would + // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer + if (not fShowVisualization) then + SingDrawBackground; + // set player names (for 2 screens and only singstar skin) if ScreenAct = 1 then begin @@ -731,15 +737,17 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; - // draw background - SingDrawBackground; - // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin if assigned(fCurrentVideoPlaybackEngine) then begin - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + // Just call this once + // when Screens = 2 + If (ScreenAct = 1) then + fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; -- cgit v1.2.3 From 31b5e9286f721b7cc81f620a28d8de5d0087c63c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 21 Mar 2009 19:11:54 +0000 Subject: New plugin mode reverted (will be moved to a branch afterwards). Party mode might work again (untested). This might break linux compatibility. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1641 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenPartyNewRound.pas | 48 +++++++++++++++++------------------- src/screens/UScreenPartyOptions.pas | 7 +++--- src/screens/UScreenPartyPlayer.pas | 23 ++++++++++------- src/screens/UScreenPartyScore.pas | 19 +++++++------- src/screens/UScreenPartyWin.pas | 15 ++++++----- src/screens/UScreenSong.pas | 19 ++++++-------- src/screens/UScreenSongMenu.pas | 15 +++++------ 7 files changed, 69 insertions(+), 77 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 01de9df7..f95f2ff1 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -215,15 +215,15 @@ var function GetTeamPlayers(const Num: Byte): String; var Players: Array of String; - //J: Byte; - begin // to-do : Party - if (Num-1 >= {PartySession.Teams.NumTeams}0) then + J: Byte; + begin + if (Num-1 >= PartySession.Teams.NumTeams) then exit; - {//Create Players Array + //Create Players Array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);} + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); //Implode and Return Result := Language.Implode(Players); @@ -231,12 +231,10 @@ var begin inherited; - // to-do : Party - //PartySession.StartRound; + PartySession.StartRound; //Set Visibility of Round Infos - // to-do : Party - I := {Length(PartySession.Rounds)}0; + I := Length(PartySession.Rounds); if (I >= 1) then begin Static[StaticRound1].Visible := True; @@ -244,8 +242,8 @@ begin Text[TextWinner1].Visible := True; //Texts: - //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - //Text[TextWinner1].Text := PartySession.GetWinnerString(0); + Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + Text[TextWinner1].Text := PartySession.GetWinnerString(0); end else begin @@ -261,8 +259,8 @@ begin Text[TextWinner2].Visible := True; //Texts: - //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - //Text[TextWinner2].Text := PartySession.GetWinnerString(1); + Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + Text[TextWinner2].Text := PartySession.GetWinnerString(1); end else begin @@ -278,8 +276,8 @@ begin Text[TextWinner3].Visible := True; //Texts: - //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - //Text[TextWinner3].Text := PartySession.GetWinnerString(2); + Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + Text[TextWinner3].Text := PartySession.GetWinnerString(2); end else begin @@ -295,8 +293,8 @@ begin Text[TextWinner4].Visible := True; //Texts: - //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - //Text[TextWinner4].Text := PartySession.GetWinnerString(3); + Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + Text[TextWinner4].Text := PartySession.GetWinnerString(3); end else begin @@ -312,8 +310,8 @@ begin Text[TextWinner5].Visible := True; //Texts: - //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - //Text[TextWinner5].Text := PartySession.GetWinnerString(4); + Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + Text[TextWinner5].Text := PartySession.GetWinnerString(4); end else begin @@ -329,8 +327,8 @@ begin Text[TextWinner6].Visible := True; //Texts: - //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - //Text[TextWinner6].Text := PartySession.GetWinnerString(5); + Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + Text[TextWinner6].Text := PartySession.GetWinnerString(5); end else begin @@ -346,8 +344,8 @@ begin Text[TextWinner7].Visible := True; //Texts: - //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - //Text[TextWinner7].Text := PartySession.GetWinnerString(6); + Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + Text[TextWinner7].Text := PartySession.GetWinnerString(6); end else begin @@ -357,7 +355,7 @@ begin end; //Display Scores - {if (PartySession.Teams.NumTeams >= 1) then + if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); @@ -445,7 +443,7 @@ begin Text[TextNextPlayer3].Visible := True; end else - Text[TextNextPlayer3].Visible := False; } + Text[TextNextPlayer3].Visible := False; end; procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index d6839778..147cb80f 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -138,10 +138,10 @@ begin //Save Num Teams: - {PartySession.Teams.NumTeams := NumTeams + 2; + PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; - PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; //Save Playlist PlaylistMan.Mode := TSingMode( Playlist ); @@ -170,8 +170,7 @@ begin PlaylistMan.CurPlayList := Playlist2; //Start Party - // to-do : Party - //PartySession.StartNewParty(Rounds + 2); + PartySession.StartNewParty(Rounds + 2); AudioPlayback.PlaySound(SoundLib.Start); //Go to Player Screen diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index d38a6435..ea8e8bc5 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -71,11 +71,18 @@ type implementation -uses UGraphic, UMain, UIni, UTexture, UParty; +uses + UGraphic, + UMain, + UIni, + UTexture, + UParty; function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; var - SDL_ModState: Word; + SDL_ModState: word; + I, J: integer; + procedure IntNext; begin repeat @@ -234,7 +241,7 @@ begin SDLK_RETURN: begin - {//Save PlayerNames + //Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -245,8 +252,8 @@ begin end; end; - AudioPlayback.PlayStart; - FadeTo(@ScreenPartyNewRound);} + AudioPlayback.PlaySound(SoundLib.Start); + FadeTo(@ScreenPartyNewRound); end; // Up and Down could be done at the same time, @@ -261,8 +268,6 @@ begin end; constructor TScreenPartyPlayer.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; @@ -310,7 +315,7 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - {If (PartySession.Teams.NumTeams>=1) then + If (PartySession.Teams.NumTeams>=1) then begin Button[0].Visible := True; Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); @@ -359,7 +364,7 @@ begin Button[12].Visible := False; Button[13].Visible := False; Button[14].Visible := False; - end; } + end; end; diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index bd54d55e..87b4a886 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -93,22 +93,21 @@ begin SDLK_BACKSPACE : begin AudioPlayback.PlaySound(SoundLib.Start); - {if (PartySession.CurRound < High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else // to-do : Party + else begin - PartySession.EndRound; } + PartySession.EndRound; FadeTo(@ScreenPartyWin); - //end; + end; end; SDLK_RETURN: begin AudioPlayback.PlaySound(SoundLib.Start); - // to-do : Party - {if (PartySession.CurRound < High(PartySession.Rounds)) then + if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else } + else FadeTo(@ScreenPartyWin); end; end; @@ -220,11 +219,11 @@ begin if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; - //End Last Round // to-do : Party - //PartySession.EndRound; + //End Last Round + PartySession.EndRound; //Set Winnertext - //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 6b4a55c0..64a50737 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -127,9 +127,9 @@ begin end; procedure TScreenPartyWin.onShow; -//var -// I: Integer; // Auto Removed, Unused Variable -// Placing: Integer; // Auto Removed, Unused Variable +var + I: Integer; + Placing: TeamOrderArray; Function GetTeamColor(Team: Byte): Cardinal; var @@ -143,13 +143,12 @@ procedure TScreenPartyWin.onShow; begin inherited; - // to-do : Party //Get Team Placing - //Placing := PartySession.GetTeamOrder; + Placing := PartySession.GetTeamOrder; //Set Winnertext - //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); - {if (PartySession.Teams.NumTeams >= 1) then + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); @@ -276,7 +275,7 @@ begin Static[StaticTeam3].Visible := False; Static[StaticTeam3BG].Visible := False; Static[StaticTeam3Deco].Visible := False; - end; } + end; end; procedure TScreenPartyWin.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 8aa5acca..8f6fafea 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -706,36 +706,36 @@ begin end; SDLK_1: - begin //Joker // to-do : Party - {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin //Joker + if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[0].Joker); SelectRandomSong; SetJoker; - end; } + end; end; SDLK_2: begin //Joker - {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then + if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[1].Joker); SelectRandomSong; SetJoker; - end; } + end; end; SDLK_3: begin //Joker - {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then + if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[2].Joker); SelectRandomSong; SetJoker; - end; } + end; end; end; end; // if (PressedDown) @@ -1775,10 +1775,8 @@ end; procedure TScreenSong.SetJoker; begin // If Party Mode - // to-do : Party if Mode = smPartyMode then //Show Joker that are available begin - (* if (PartySession.Teams.NumTeams >= 1) then begin Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); @@ -1829,7 +1827,6 @@ begin Static[StaticTeam3Joker4].Visible := false; Static[StaticTeam3Joker5].Visible := false; end; - *) end else begin //Hide all @@ -1920,7 +1917,6 @@ end; //Team No of Team (0-5) procedure TScreenSong.DoJoker (Team: Byte); begin - { if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= Team + 1) and (PartySession.Teams.Teaminfo[Team].Joker > 0) then @@ -1930,7 +1926,6 @@ begin SelectRandomSong; SetJoker; end; - } end; //Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index fb3b0f93..8d75eb67 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -399,19 +399,16 @@ begin begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - // to-do : Party -{ - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0); + + 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[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 @@ -422,10 +419,10 @@ begin if (not Button[2].Visible) then Interaction := 4 else - Interaction := 2; + Interaction := 2; end else - Interaction := 1; + Interaction := 1; end; end; -- cgit v1.2.3 From da59aa15bc4f42de0268d389a8d7dca1bbf19ee7 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 21 Mar 2009 23:51:48 +0000 Subject: party fix for linux: - plugin-path from UPath used - calling convention must be cdecl for a non-windows os git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1646 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSingModi.pas | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 4ead8e55..a8bd7473 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -109,11 +109,19 @@ var CustomSounds: array of TCustomSoundEntry; //Procedured for Plugin -function LoadTex (const Name: PChar; Typ: TTextureType): 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 +function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//function Translate (const Name: PChar): PChar; +// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Procedure to Print Text +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Procedure that loads a Custom Sound +function LoadSound(const Name: PChar): Cardinal; + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +//Plays a Custom Sound +procedure PlaySound(const Index: Cardinal); + {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Utilys function ToSentences(Const Lines: TLines): TSentences; @@ -665,7 +673,7 @@ Winner := DllMan.PluginFinish(PlayerInfo); //DLLMan.UnLoadPlugin; end; -function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; +function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; var Texname, EXT: String; Tex: TTexture; @@ -691,7 +699,8 @@ 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 +//Procedure to Print Text +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); @@ -702,7 +711,8 @@ begin glPrint (Language.Translate(String(Text))); end; -function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +//Procedure that loads a Custom Sound +function LoadSound(const Name: PChar): Cardinal; var Stream: TAudioPlaybackStream; i: Integer; @@ -731,7 +741,8 @@ begin Result := High(CustomSounds); end; -procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound +//Plays a Custom Sound +procedure PlaySound(const Index: Cardinal); begin if (Index <= High(CustomSounds)) then AudioPlayback.PlaySound(CustomSounds[Index].Stream); -- cgit v1.2.3 From 41d17ac45a0e1178354148798defcc07ee4d481e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 23 Mar 2009 12:53:06 +0000 Subject: Fixed some displaying issues w/ old party mode - score wasn't drawn - video wasn't drawn Lyricshelper is still not present git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1653 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 3 +- src/screens/UScreenSingModi.pas | 278 +++++++--------------------------------- 2 files changed, 50 insertions(+), 231 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index ee5164db..b5b93831 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -58,9 +58,8 @@ type type TScreenSing = class(TMenu) - private - VideoLoaded: boolean; protected + VideoLoaded: boolean; Paused: boolean; // pause mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index a8bd7473..9108cd71 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -55,36 +55,8 @@ uses UMenu, 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; @@ -95,7 +67,6 @@ type function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure Finish; override; - //procedure Pause; //Pause Mod(Toggles Pause) end; type @@ -289,6 +260,8 @@ begin Winner := 0; //Set Score Visibility + Scores.Visible := DLLMan.Selected.ShowScore; + {if PlayersPlay = 1 then begin Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -338,115 +311,37 @@ begin 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'); - - + Background.Draw; + // draw background picture (if any, and if no visualizations) + // when we don't check for visualizations the visualizations would + // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) AND (not fShowVisualization) then + SingDrawBackground; - 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; + // 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 + Else 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? @@ -459,92 +354,6 @@ begin Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // .. and scores - {if PlayersPlay = 1 then begin - TextStr := IntToStr(Player[0].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1Score].Text := TextStr; - end; - - if PlayersPlay = 2 then begin - TextStr := IntToStr(Player[0].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1TwoPScore].Text := TextStr; - - TextStr := IntToStr(Player[1].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2RScore].Text := TextStr; - end; - - if PlayersPlay = 3 then begin - TextStr := IntToStr(Player[0].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1ThreePScore].Text := TextStr; - - TextStr := IntToStr(Player[1].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2MScore].Text := TextStr; - - TextStr := IntToStr(Player[2].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP3RScore].Text := TextStr; - end; - - if PlayersPlay = 4 then begin - if ScreenAct = 1 then begin - TextStr := IntToStr(Player[0].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1TwoPScore].Text := TextStr; - - TextStr := IntToStr(Player[1].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2RScore].Text := TextStr; - end; - if ScreenAct = 2 then begin - TextStr := IntToStr(Player[2].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1TwoPScore].Text := TextStr; - - TextStr := IntToStr(Player[3].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2RScore].Text := TextStr; - end; - end; - - if PlayersPlay = 6 then begin - if ScreenAct = 1 then begin - TextStr := IntToStr(Player[0].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1ThreePScore].Text := TextStr; - - TextStr := IntToStr(Player[1].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2MScore].Text := TextStr; - - TextStr := IntToStr(Player[2].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP3RScore].Text := TextStr; - end; - if ScreenAct = 2 then begin - TextStr := IntToStr(Player[3].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP1ThreePScore].Text := TextStr; - - TextStr := IntToStr(Player[4].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP2MScore].Text := TextStr; - - TextStr := IntToStr(Player[5].ScoreTotalI); - while Length(TextStr) < 5 do TextStr := '0' + TextStr; - Text[TextP3RScore].Text := TextStr; - end; - end; } - - end; //ShowScore - for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; @@ -565,18 +374,26 @@ begin 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; - // update and draw movie { if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} + // update and draw movie + if (ShowFinish and (VideoLoaded or fShowVisualization) and DllMan.Selected.LoadVideo) then + begin + if assigned(fCurrentVideoPlaybackEngine) then + begin + // Just call this once + // when Screens = 2 + If (ScreenAct = 1) then + fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + + + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + end; + end; + // draw static menu (FG) DrawFG; @@ -604,6 +421,9 @@ begin GoldenRec.SpawnRec; //GoldenNoteStarsTwinkle Mod + //Draw Score + Scores.Draw; + //Update PlayerInfo for I := 0 to PlayerInfo.NumPlayers-1 do begin -- cgit v1.2.3 From 442fe6a73506979404f2d1f7bb2c2cffa4b69054 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 6 Apr 2009 22:17:39 +0000 Subject: bring the type align to our coding standards git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1658 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index bdf85028..8d4d7f28 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1282,7 +1282,7 @@ begin Lyric.Clear; Lyric.X := 400; Lyric.Y := 500; - Lyric.Align := center; + Lyric.Align := atCenter; Lyric.Size := 42; Lyric.ColR := 0; Lyric.ColG := 0; -- cgit v1.2.3 From c7f5d683c1eae49e30ee42a76557661f57311b9e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 25 Apr 2009 10:09:59 +0000 Subject: Cosmetics. No code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1694 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 942 +++++++++++++++++++-------------- src/screens/UScreenEditConvert.pas | 43 +- src/screens/UScreenEditHeader.pas | 6 +- src/screens/UScreenEditSub.pas | 98 ++-- src/screens/UScreenLevel.pas | 25 +- src/screens/UScreenLoading.pas | 9 +- src/screens/UScreenMain.pas | 10 +- src/screens/UScreenName.pas | 23 +- src/screens/UScreenOpen.pas | 10 +- src/screens/UScreenOptions.pas | 18 +- src/screens/UScreenOptionsAdvanced.pas | 27 +- src/screens/UScreenOptionsGame.pas | 22 +- src/screens/UScreenOptionsGraphics.pas | 35 +- src/screens/UScreenOptionsLyrics.pas | 20 +- src/screens/UScreenOptionsRecord.pas | 10 +- src/screens/UScreenOptionsSound.pas | 16 +- src/screens/UScreenOptionsThemes.pas | 9 +- src/screens/UScreenPartyNewRound.pas | 298 ++++++----- src/screens/UScreenPartyOptions.pas | 8 +- src/screens/UScreenPartyPlayer.pas | 80 +-- src/screens/UScreenPartyScore.pas | 144 ++--- src/screens/UScreenPartyWin.pas | 135 ++--- src/screens/UScreenPopup.pas | 86 +-- src/screens/UScreenSing.pas | 3 +- src/screens/UScreenSingModi.pas | 134 ++--- src/screens/UScreenSong.pas | 50 +- src/screens/UScreenSongJumpto.pas | 59 ++- src/screens/UScreenSongMenu.pas | 7 +- src/screens/UScreenStatDetail.pas | 45 +- src/screens/UScreenStatMain.pas | 65 +-- src/screens/UScreenTop5.pas | 3 +- src/screens/UScreenWelcome.pas | 39 +- 32 files changed, 1361 insertions(+), 1118 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 6e5c5ba7..2982fe24 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -34,17 +34,17 @@ interface {$I switches.inc} uses - SysUtils, - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - gl, - UMusic, - UFiles, - UThemes, - UGraphicClasses; + SysUtils, + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + gl, + UMusic, + UFiles, + UThemes, + UGraphicClasses; type TCreditsStages=(InitialDelay,Intro,MainPart,Outro); @@ -52,12 +52,12 @@ type TScreenCredits = class(TMenu) public - Credits_X: Real; - Credits_Time: Cardinal; - Credits_Alpha: Cardinal; - CTime: Cardinal; - CTime_hold: Cardinal; - ESC_Alpha: Integer; + Credits_X: real; + Credits_Time: cardinal; + Credits_Alpha: cardinal; + CTime: cardinal; + CTime_hold: cardinal; + ESC_Alpha: integer; credits_entry: TTexture; credits_entry_dx: TTexture; @@ -89,16 +89,16 @@ type deluxe_slidein: cardinal; - CurrentScrollText: String; - NextScrollUpdate: Real; - EndofLastScrollingPart: Cardinal; - CurrentScrollStart, CurrentScrollEnd: Integer; + CurrentScrollText: string; + NextScrollUpdate: real; + EndofLastScrollingPart: cardinal; + CurrentScrollStart, CurrentScrollEnd: integer; CRDTS_Stage: TCreditsStages; Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure onShow; override; procedure onHide; override; @@ -113,7 +113,7 @@ const '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,..'; - CRDTS_BG_FILE = 'credits_v5_bg.png'; + CRDTS_BG_FILE = 'credits_v5_bg.png'; CRDTS_OVL_FILE = 'credits_v5_overlay.png'; CRDTS_blindguard_FILE = 'names_blindguard.png'; CRDTS_blindy_FILE = 'names_blindy.png'; @@ -137,7 +137,7 @@ const OUTRO_ESC_FILE = 'outro-esc.png'; OUTRO_EXD_FILE = 'outro-exit-dark.png'; - Timings: array[0..21] of Cardinal=( + Timings: array[0..21] of cardinal=( 20, // 0 Delay vor Start 149, // 1 Ende erster Intro Zoom @@ -178,10 +178,10 @@ uses UCommon, UPath; -function TScreenCredits.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenCredits.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down case PressedKey of @@ -243,14 +243,14 @@ end; function TScreenCredits.Draw: boolean; begin DrawCredits; - Draw:=true; + Draw := true; end; procedure TScreenCredits.onShow; begin inherited; - CRDTS_Stage:=InitialDelay; + CRDTS_Stage := InitialDelay; Credits_X := 580; deluxe_slidein := 0; Credits_Alpha := 0; @@ -268,8 +268,8 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S: Integer; - X,Y,A: Real; + S: integer; + X,Y,A: real; visibleText: string; begin SetFontSize(30); @@ -326,46 +326,47 @@ begin { // timing hack X:=5; SetFontStyle (2); - SetFontItalic(False); + SetFontItalic(false); SetFontSize(27); glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do begin - visibleText:=inttostr(CTime_hold[S]); - SetFontPos (500, X); - glPrint (visibleText[0]); - X:=X+20; + for S:=0 to high(CTime_hold) do + begin + visibleText := inttostr(CTime_hold[S]); + SetFontPos (500, X); + glPrint(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; + 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); + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); end; procedure TScreenCredits.DrawCredits; var - T: Cardinal; - Data: TFFTData; - j,k,l:cardinal; - f,g: Real; - STime:cardinal; - Delay:cardinal; - myScale: Real; - myAngle: Real; + T: cardinal; + Data: TFFTData; + j, k, l: cardinal; + f, g: real; + STime: cardinal; + Delay: cardinal; + myScale: real; + myAngle: real; const - myLogoCoords: Array[0..27,0..1] of Cardinal = ( + 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), @@ -389,19 +390,19 @@ begin Credits_X := Credits_X-2; Log.LogStatus('',' JB-2'); - if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then + if (CRDTS_Stage=InitialDelay) and (CTime = Timings[0]) then begin - //CTime:=Timings[20]; - //CRDTS_Stage:=Outro; - CRDTS_Stage:=Intro; - CTime:=0; + //CTime := Timings[20]; + //CRDTS_Stage := Outro; + CRDTS_Stage := Intro; + CTime := 0; AudioPlayback.Play; end; - if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then + if (CRDTS_Stage = Intro) and (CTime = Timings[7]) then begin - CRDTS_Stage:=MainPart; + CRDTS_Stage := MainPart; end; - if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then + if (CRDTS_Stage = MainPart) and (CTime = Timings[20]) then begin CRDTS_Stage:=Outro; end; @@ -410,143 +411,150 @@ begin Log.LogStatus('',' JB-3'); //draw background - if CRDTS_Stage=InitialDelay then - begin - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end + 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; + if CRDTS_Stage = Intro then + begin + Start3D; + glPushMatrix; - glClearColor(0,0,0,0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + 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); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - 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; + 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); - // 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; + 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; + // 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; + end; if (CRDTS_Stage=MainPart) then // main credits screen background, scroller, logo and girl begin @@ -572,38 +580,50 @@ begin //######################################################################### // draw credits names - Log.LogStatus('',' JB-4'); // BlindGuard (rotate in from upper left, rotate out to lower right) - STime:=Timings[9]-10; - Delay:=Timings[10]-Timings[9]; + STime := Timings[9]-10; + Delay := Timings[10]-Timings[9]; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -617,22 +637,25 @@ begin glPushMatrix; gltranslatef(0,329,0); - if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + if CTime <= STime + 10 then + glrotatef((CTime - STime) * 9 + 270,0,0,1); 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; + 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); + 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); @@ -640,35 +663,47 @@ begin end; // Blindy (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) - STime:=Timings[10]-10; - Delay:=Timings[11]-Timings[10]+5; + STime := Timings[10] - 10; + Delay := Timings[11] - Timings[10] + 5; if CTime > STime then begin - k:=0; - ESC_Alpha:=20; + k := 0; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -682,18 +717,21 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+20 then begin - j:=CTime-Stime; + 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; + 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); @@ -710,35 +748,47 @@ begin end; // Canni (shift in from left, shift out to upper right) - STime:=Timings[11]-10; - Delay:=Timings[12]-Timings[11]+5; + STime := Timings[11]-10; + Delay := Timings[12]-Timings[11]+5; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -752,10 +802,12 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then begin + 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 + if CTime >= STime + Delay - 10 then if CTime <= STime + Delay then + begin j:=(CTime-(STime+Delay-10))*21; gltranslatef(j,-j/2,0); end; @@ -775,35 +827,47 @@ begin end; // Commandio (flip in from down, flip out to upper right) - STime:=Timings[12]-10; - Delay:=Timings[13]-Timings[12]; + STime := Timings[12]-10; + Delay := Timings[13]-Timings[12]; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -817,15 +881,17 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then + 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; + 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); @@ -842,33 +908,44 @@ begin 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; + STime := Timings[13]-35; + Delay := Timings[14]-Timings[13]+5; if CTime > STime then begin k:=0; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + 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; + 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; @@ -889,36 +966,47 @@ begin end; // Mog (flip in from right, flip out to lower right) - STime:=Timings[14]-10; - Delay:=Timings[15]-Timings[14]+5; + STime := Timings[14]-10; + Delay := Timings[15]-Timings[14]+5; if CTime > STime then begin k:=0; - ESC_Alpha:=20; - + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -932,15 +1020,16 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) + if CTime <= STime + 10 then + f := 326.0 - 32.6 * (CTime - STime) else - f:=0; + 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; + 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); @@ -958,35 +1047,47 @@ begin end; // Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing) - STime:=Timings[15]-10; - Delay:=Timings[16]-Timings[15]+5; + STime := Timings[15]-10; + Delay := Timings[16]-Timings[15]+5; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -1000,18 +1101,21 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then begin + 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; + 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); @@ -1028,35 +1132,47 @@ begin end; // Skillmaster (shift in from lower right, rotate out to upper right) - STime:=Timings[16]-10; - Delay:=Timings[17]-Timings[16]+5; + STime := Timings[16]-10; + Delay := Timings[17]-Timings[16]+5; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -1070,18 +1186,21 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then begin - j:=STime+10-CTime; - f:=j*10.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; + 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); @@ -1098,35 +1217,47 @@ begin end; // WhiteShark (flip in from lower left, flip out to upper right) - STime:=Timings[17]-10; - Delay:=Timings[18]-Timings[17]; + STime := Timings[17] - 10; + Delay := Timings[18] - Timings[17]; if CTime > STime then begin k:=0; - ESC_Alpha:=20; + ESC_Alpha := 20; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - - if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); - if ESC_Alpha >20 then ESC_Alpha:=20; - if ((CTime-STime)<20) then ESC_Alpha:=20; - if CTime <=STime+10 then j:=CTime-STime else j:=10; - if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + 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 + 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); @@ -1140,19 +1271,19 @@ begin glPushMatrix; gltranslatef(223,329,0); - if CTime <= STime+10 then - f:=326.0-32.6*(CTime-STime) + if CTime <= STime + 10 then + f := 326.0 - 32.6 * (CTime - STime) else - f:=0; + f := 0; - if (CTime >= STime+Delay-10) and (CTime <= STime+Delay) then + if (CTime >= STime + Delay - 10) and (CTime <= STime + Delay) then begin - j:=CTime-(STime+Delay-10); - g:=32.6*j; + j := CTime - (STime + Delay - 10); + g := 32.6 * j; end else begin - g:=0; + g := 0; end; glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); @@ -1160,41 +1291,40 @@ begin 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); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1);glVertex2f( 163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f( 163-f*1.5+g/4, -129+f*1.5+g/4); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); glPopMatrix; end; - Log.LogStatus('',' JB-103'); // #################################################################### // do some twinkle stuff (kinda on beat) - if (CTime > Timings[8] ) and - (CTime < Timings[19] ) then + if (CTime > Timings[8] ) and + (CTime < Timings[19]) then begin k := 0; try - for j:=0 to 40 do + for j := 0 to 40 do begin - if ( j < length( Data ) ) AND - ( k < length( Data ) ) then + if (j < length(Data)) and + (k < length(Data)) then begin if Data[j] >= Data[k] then - k:=j; + k := j; end; end; except end; - if Data[k]>0.2 then + if Data[k] > 0.2 then begin l := RandomRange(6,16); j := RandomRange(0,27); @@ -1246,19 +1376,21 @@ begin end; end else - if (CRDTS_Stage=Outro) then + if (CRDTS_Stage = Outro) then begin - if CTime=Timings[20] then begin - CTime_hold:=0; + if CTime = Timings[20] then + begin + CTime_hold := 0; AudioPlayback.Stop; AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); AudioPlayback.SetVolume(0.2); - AudioPlayback.SetLoop(True); + AudioPlayback.SetLoop(true); AudioPlayback.Play; end; - if CTime_hold > 231 then begin + if CTime_hold > 231 then + begin AudioPlayback.Play; - Ctime_hold:=0; + Ctime_hold := 0; end; glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); @@ -1288,11 +1420,13 @@ begin 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; + 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); @@ -1311,12 +1445,12 @@ begin { // draw credits runtime counter SetFontStyle (2); - SetFontItalic(False); + SetFontItalic(false); SetFontSize(27); 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); + //RuntimeStr := 'CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr := 'CTime: ' + inttostr(CTime); glPrint (RuntimeStr[1]); } diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 89fd64c5..361a3be7 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -136,7 +136,7 @@ uses function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -179,15 +179,15 @@ begin end; if Interaction = 2 then - begin + begin Selected := true; {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := nil; {$ENDIF} {for T := 0 to High(ATrack) do - begin + begin if ATrack[T].Hear then - begin + begin MidiTrack := MidiFile.GetTrack(T); MidiTrack.OnMidiEvent := MidiFile1MidiEvent; end; @@ -196,9 +196,9 @@ begin end; if Interaction = 3 then - begin + begin if SelectedNumber > 0 then - begin + begin Extract; SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false); end; @@ -209,16 +209,16 @@ begin SDLK_SPACE: begin // ATrack[Sel].Hear := not ATrack[Sel].Hear; - if Notes in ATrack[Sel].Status then - begin - ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; - if Lyrics in ATrack[Sel].Status then - ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] - else - ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; - end - else - ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; + if Notes in ATrack[Sel].Status then + begin + ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; + if Lyrics in ATrack[Sel].Status then + ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] + else + ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; + end + else + ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; { if Selected then begin @@ -244,13 +244,13 @@ begin begin Inc(Sel); if Sel > High(ATrack) then - Sel := 0; + Sel := 0; end; SDLK_UP: begin Dec(Sel); if Sel < 0 then - Sel := High(ATrack); + Sel := High(ATrack); end; end; end; @@ -312,7 +312,7 @@ begin for N := 0 to High(ATrack[T].Note) do begin if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then - begin + begin Nu := Length(Note); SetLength(Note, Nu + 1); Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); @@ -334,7 +334,7 @@ begin for N := 0 to High(ATrack[T].Note) do begin if (ATrack[T].Note[N].EventType = 15) then - begin + begin // Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); end; @@ -452,7 +452,6 @@ begin AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(20, 5, 0, 0, 0, 'Save'); - { MidiOut := TMidiOutput.Create(nil); // MidiOut.Close; // MidiOut.DeviceID := 0; @@ -492,13 +491,11 @@ begin Log.LogStatus(MidiOut.ProductName, 'MIDI'); MidiOut.Open; - if FileExists(ConversionFileName) then begin MidiFile.Filename := ConversionFileName; MidiFile.ReadFile; - Len := 0; Sel := 0; BPM := MidiFile.Bpm; diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index fb0b2c85..ad0fc40a 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -115,7 +115,7 @@ begin SDLK_RETURN: begin if Interaction = 1 then - begin + begin // Save; end; end; @@ -158,7 +158,7 @@ begin begin T := Interaction - 2 + TextTitle; if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then - begin + begin Text[T].DeleteLastL; SetRoundButtons; end; @@ -169,7 +169,7 @@ begin #32..#255: begin if (Interaction >= 2) and (Interaction <= 13) then - begin + begin Text[Interaction - 2 + TextTitle].Text := Text[Interaction - 2 + TextTitle].Text + CharCode; SetRoundButtons; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 8d4d7f28..3e1f3c1c 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -132,11 +132,11 @@ uses USkins, ULanguage; -// Method for input parsing. If False is returned, GetNextWindow +// Method for input parsing. If false is returned, GetNextWindow // should be checked to know the next window to load; function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var - SDL_ModState: Word; + SDL_ModState: word; R: real; begin Result := true; @@ -205,7 +205,7 @@ begin begin // Paste text if SDL_ModState = KMOD_LCTRL then - begin + begin if Lines[0].Line[Lines[0].Current].HighNote >= Lines[0].Line[CopySrc].HighNote then PasteText else @@ -213,7 +213,7 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); end; end; @@ -333,7 +333,7 @@ begin SDLK_4: begin if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); @@ -341,14 +341,14 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then - begin + begin CopySentences(CopySrc, Lines[0].Current, 4); end; end; SDLK_5: begin if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); @@ -357,7 +357,7 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then - begin + begin CopySentences(CopySrc, Lines[0].Current, 5); end; end; @@ -400,21 +400,21 @@ begin SDLK_SLASH: begin if SDL_ModState = 0 then - begin + begin // Insert start of sentece if CurrentNote > 0 then DivideSentence; end; if SDL_ModState = KMOD_LSHIFT then - begin + begin // Join next sentence with current if Lines[0].Current < Lines[0].High then JoinSentence; end; if SDL_ModState = KMOD_LCTRL then - begin + begin // divide note DivideNote; end; @@ -449,7 +449,7 @@ begin SDLK_DELETE: begin if SDL_ModState = KMOD_LCTRL then - begin + begin // moves text to right in current sentence DeleteNote; end; @@ -465,24 +465,24 @@ begin begin // right if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then - CurrentNote := 0; + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + right if SDL_ModState = KMOD_LCTRL then - begin + begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); if CurrentNote = 0 then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; end; @@ -490,10 +490,10 @@ begin // shift + right if SDL_ModState = KMOD_LSHIFT then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); if CurrentNote = 0 then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then @@ -502,7 +502,7 @@ begin // alt + right if SDL_ModState = KMOD_LALT then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Inc(Lines[0].Line[Lines[0].Current].End_); @@ -510,7 +510,7 @@ begin // alt + ctrl + shift + right = move all from cursor to right if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then - begin + begin MoveAllToEnd(1); end; @@ -520,34 +520,34 @@ begin begin // left if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); if CurrentNote = -1 then - CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + left if SDL_ModState = KMOD_LCTRL then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = 0 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; end; // shift + left if SDL_ModState = KMOD_LSHIFT then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); // resizing sentences if CurrentNote = 0 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; @@ -558,9 +558,9 @@ begin // alt + left if SDL_ModState = KMOD_LALT then - begin + begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Dec(Lines[0].Line[Lines[0].Current].End_); @@ -569,7 +569,7 @@ begin // alt + ctrl + shift + right = move all from cursor to left if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then - begin + begin MoveAllToEnd(-1); end; @@ -580,7 +580,7 @@ begin // skip to next sentence if SDL_ModState = 0 then - begin {$IFDEF UseMIDIPort} + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; {$endif} @@ -589,7 +589,7 @@ begin Inc(Lines[0].Current); CurrentNote := 0; if Lines[0].Current > Lines[0].High then - Lines[0].Current := 0; + Lines[0].Current := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -600,7 +600,7 @@ begin // decrease tone if SDL_ModState = KMOD_LCTRL then - begin + begin TransposeNote(-1); end; @@ -611,7 +611,7 @@ begin // skip to previous sentence if SDL_ModState = 0 then - begin + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; @@ -621,7 +621,7 @@ begin Dec(Lines[0].Current); CurrentNote := 0; if Lines[0].Current = -1 then - Lines[0].Current := Lines[0].High; + Lines[0].Current := Lines[0].High; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -632,7 +632,7 @@ begin // increase tone if SDL_ModState = KMOD_LCTRL then - begin + begin TransposeNote(1); end; end; @@ -644,7 +644,7 @@ end; function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var - SDL_ModState: Word; + SDL_ModState: word; begin // used when in Text Edit Mode Result := true; @@ -679,11 +679,11 @@ begin begin // right if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then - CurrentNote := 0; + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -692,11 +692,11 @@ begin begin // left if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); if CurrentNote = -1 then - CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -877,7 +877,7 @@ begin Lines[0].Line[CNew].Start := Lines[0].Line[CStart].Note[NStart].Start; Lines[0].Line[CNew].Lyric := ''; Lines[0].Line[CNew].End_ := 0; - Lines[0].Line[CNew].BaseNote := 0;//High(Integer); // TODO: High (Integer) will causes a memory exception later in this procedure. Weird! + Lines[0].Line[CNew].BaseNote := 0;//High(integer); // TODO: High (integer) will causes a memory exception later in this procedure. Weird! Lines[0].Line[CNew].HighNote := -1; SetLength(Lines[0].Line[CNew].Note, 0); @@ -907,9 +907,9 @@ begin //recalculate BaseNote of the divided Sentence with Lines[0].Line[CStart] do begin - BaseNote := High(Integer); + BaseNote := High(integer); - For N := 0 to HighNote do + for N := 0 to HighNote do if Note[N].Tone < BaseNote then BaseNote := Note[N].Tone; end; @@ -991,7 +991,7 @@ begin C := Lines[0].Current; //Do Not delete Last Note - if (Lines[0].High > 0) OR (Lines[0].Line[C].HighNote > 0) then + if (Lines[0].High > 0) or (Lines[0].Line[C].HighNote > 0) then begin // we copy all notes from the next to the selected one @@ -1181,7 +1181,6 @@ begin CopySentence(Src + C, Dst + C); end; - constructor TScreenEditSub.Create; begin inherited Create; @@ -1250,7 +1249,7 @@ begin else Error := not CurrentSong.LoadSong(); except - Error := True; + Error := true; end; if Error then @@ -1315,7 +1314,6 @@ begin {$IFDEF UseMIDIPort} MidiPos := USTime.GetTime - MidiTime + MidiStart; - // stop the music if (MidiPos > MidiStop) then begin @@ -1334,7 +1332,6 @@ begin if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then begin - LastClick := AktBeat; {$IFDEF UseMIDIPort} if Pet > 0 then @@ -1426,7 +1423,8 @@ begin end; function TScreenEditSub.GetNoteName(Note: integer): string; -var N1, N2: integer; +var + N1, N2: integer; begin if (Note > 0) then begin diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index a632cf78..b41a8535 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -34,29 +34,36 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenLevel = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses UGraphic, - UMain, - UIni, - USong, - UTexture; +uses + UGraphic, + UMain, + UIni, + USong, + UTexture; -function TScreenLevel.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenLevel.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of diff --git a/src/screens/UScreenLoading.pas b/src/screens/UScreenLoading.pas index f4a3508a..ea639ba3 100644 --- a/src/screens/UScreenLoading.pas +++ b/src/screens/UScreenLoading.pas @@ -46,15 +46,16 @@ type Fadeout: boolean; constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; end; implementation -uses UGraphic, - UTime; +uses + UGraphic, + UTime; -function TScreenLoading.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenLoading.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; end; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 4980021e..36cf84b0 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -79,7 +79,7 @@ function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; var SDL_ModState: word; begin - Result := True; + Result := true; SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -90,7 +90,7 @@ begin case WideCharUpperCase(CharCode)[1] of 'Q': begin - Result := False; + Result := false; Exit; end; 'C': @@ -128,7 +128,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - Result := False; + Result := false; end; SDLK_RETURN: @@ -143,7 +143,7 @@ begin if (Ini.Players = 4) then PlayersPlay := 6; - ScreenName.Goto_SingScreen := False; + ScreenName.Goto_SingScreen := false; FadeTo(@ScreenName, SoundLib.Start); end else //show error message @@ -187,7 +187,7 @@ begin //Exit if Interaction = 5 then begin - Result := False; + Result := false; end; end; {** diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index 055f644e..d13db170 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -45,9 +45,9 @@ uses type TScreenName = class(TMenu) public - Goto_SingScreen: Boolean; //If True then next Screen in SingScreen + Goto_SingScreen: boolean; //If true then next Screen in SingScreen constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -61,14 +61,13 @@ uses UNote, UTexture; - -function TScreenName.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenName.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var - I: integer; -SDL_ModState: Word; + I: integer; + SDL_ModState: word; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT @@ -194,7 +193,6 @@ begin Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; end; - SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastL; @@ -222,7 +220,7 @@ begin else FadeTo(@ScreenLevel); - GoTo_SingScreen := False; + GoTo_SingScreen := false; end; // Up and Down could be done at the same time, @@ -244,7 +242,6 @@ begin LoadFromTheme(Theme.Name); - for I := 1 to 6 do AddButton(Theme.Name.ButtonPlayer[I]); @@ -260,12 +257,14 @@ begin for I := 1 to 6 do Button[I-1].Text[0].Text := Ini.Name[I-1]; - for I := 1 to PlayersPlay do begin + for I := 1 to PlayersPlay do + begin Button[I-1].Visible := true; Button[I-1].Selectable := true; end; - for I := PlayersPlay+1 to 6 do begin + for I := PlayersPlay+1 to 6 do + begin Button[I-1].Visible := false; Button[I-1].Selectable := false; end; diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index fe9f0664..a854e81b 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -88,7 +88,7 @@ begin '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '.', ':', '\': begin if Interaction = 0 then - begin + begin Text[TextN].Text := Text[TextN].Text + CharCode; end; end; @@ -119,7 +119,7 @@ begin SDLK_RETURN: begin if (Interaction = 2) then - begin + begin //Update Filename and go to last Screen ConversionFileName := Text[TextN].Text; AudioPlayback.PlaySound(SoundLib.Back); @@ -203,7 +203,8 @@ begin Interaction := 0; end; -(*function TScreenEditSub.Draw: boolean; +(* +function TScreenEditSub.Draw: boolean; var Min: integer; Sec: integer; @@ -215,6 +216,7 @@ end; procedure TScreenEditSub.Finish; begin // -end;*) +end; +*) end. diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 10785b86..a6486075 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -34,14 +34,21 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, UDisplay, UMusic, UFiles, UIni, UThemes; + UMenu, + SDL, + SysUtils, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptions = class(TMenu) public TextDescription: integer; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; @@ -52,12 +59,13 @@ type implementation -uses UGraphic; +uses + UGraphic; -function TScreenOptions.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 8960640d..f57ee865 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -34,24 +34,32 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsAdvanced = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; end; implementation -uses UGraphic, SysUtils; +uses + UGraphic, + SysUtils; -function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsAdvanced.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -76,7 +84,8 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if SelInteraction = 7 then begin - if SelInteraction = 6 then begin + if SelInteraction = 6 then + begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); @@ -90,7 +99,8 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; @@ -99,7 +109,8 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index e634419b..3c78363f 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -34,26 +34,35 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes, USongs; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes, + USongs; type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure RefreshSongs; end; implementation -uses UGraphic, SysUtils; +uses + UGraphic, + SysUtils; -function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -76,7 +85,8 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 6 then begin + if SelInteraction = 6 then + begin AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 2e2b4f0e..896f3d99 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -46,18 +46,22 @@ type TScreenOptionsGraphics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; end; implementation -uses UGraphic, UMain, SysUtils, TypInfo; +uses + UGraphic, + UMain, + SysUtils, + TypInfo; -function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsGraphics.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -80,10 +84,12 @@ begin end; SDLK_RETURN: begin -{ if SelInteraction <= 1 then begin +{ if SelInteraction <= 1 then + begin Restart := true; end;} - if SelInteraction = 6 then begin + if SelInteraction = 6 then + begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); // FIXME: changing the video mode does not work this way in windows @@ -101,14 +107,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction < 6) then begin + if (SelInteraction >= 0) and (SelInteraction < 6) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction < 6) then begin + if (SelInteraction >= 0) and (SelInteraction < 6) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -124,13 +132,12 @@ begin inherited Create; LoadFromTheme(Theme.OptionsGraphics); - AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); - AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); - AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); - AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); + AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); + AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); - AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); - + AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index b5228a52..7efe1cd2 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -46,18 +46,20 @@ type TScreenOptionsLyrics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; end; implementation -uses UGraphic, SysUtils; +uses + UGraphic, + SysUtils; -function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsLyrics.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -80,7 +82,8 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 3 then begin + if SelInteraction = 3 then + begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); @@ -92,14 +95,16 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then + begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -119,7 +124,6 @@ begin //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!! AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); - AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index f6ff85c6..3737a134 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -95,7 +95,7 @@ type public constructor Create; override; function Draw: boolean; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure onHide; override; end; @@ -128,10 +128,10 @@ uses UIni, ULog; -function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsRecord.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -484,7 +484,6 @@ begin PreviewDeviceIndex := -1; end; - procedure TScreenOptionsRecord.DrawVolume(x, y, Width, Height: single); var x1, y1, x2, y2: single; @@ -802,8 +801,7 @@ begin end; end; - Result := True; + Result := true; end; - end. diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 80210f63..99ecb599 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -34,7 +34,13 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, UIni, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + UIni, + UThemes; type TScreenOptionsSound = class(TMenu) @@ -47,19 +53,21 @@ type implementation -uses UGraphic, SysUtils; +uses + UGraphic, + SysUtils; function TScreenOptionsSound.ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; begin - Result := True; + Result := true; if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of 'Q': begin - Result := False; + Result := false; Exit; end; end; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 4970de21..e44bfca8 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -47,9 +47,9 @@ type private procedure ReloadTheme; public - SkinSelect: Integer; + SkinSelect: integer; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure InteractInc; override; procedure InteractDec; override; @@ -64,10 +64,10 @@ uses UPath, USkins; -function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenOptionsThemes.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -190,7 +190,6 @@ begin ScreenOptionsThemes.Interaction := self.Interaction; ScreenOptionsThemes.Draw; - Display.Draw; SwapBuffers; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index f95f2ff1..03a72fa9 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -34,87 +34,93 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenPartyNewRound = class(TMenu) public //Texts: - TextRound1: Cardinal; - TextRound2: Cardinal; - TextRound3: Cardinal; - TextRound4: Cardinal; - TextRound5: Cardinal; - TextRound6: Cardinal; - TextRound7: Cardinal; - - TextWinner1: Cardinal; - TextWinner2: Cardinal; - TextWinner3: Cardinal; - TextWinner4: Cardinal; - TextWinner5: Cardinal; - TextWinner6: Cardinal; - TextWinner7: Cardinal; - - TextNextRound: Cardinal; - TextNextRoundNo: Cardinal; - TextNextPlayer1: Cardinal; - TextNextPlayer2: Cardinal; - TextNextPlayer3: Cardinal; + TextRound1: cardinal; + TextRound2: cardinal; + TextRound3: cardinal; + TextRound4: cardinal; + TextRound5: cardinal; + TextRound6: cardinal; + TextRound7: cardinal; + + TextWinner1: cardinal; + TextWinner2: cardinal; + TextWinner3: cardinal; + TextWinner4: cardinal; + TextWinner5: cardinal; + TextWinner6: cardinal; + TextWinner7: cardinal; + + TextNextRound: cardinal; + TextNextRoundNo: cardinal; + TextNextPlayer1: cardinal; + TextNextPlayer2: cardinal; + TextNextPlayer3: cardinal; //Statics - StaticRound1: Cardinal; - StaticRound2: Cardinal; - StaticRound3: Cardinal; - StaticRound4: Cardinal; - StaticRound5: Cardinal; - StaticRound6: Cardinal; - StaticRound7: Cardinal; + StaticRound1: cardinal; + StaticRound2: cardinal; + StaticRound3: cardinal; + StaticRound4: cardinal; + StaticRound5: cardinal; + StaticRound6: cardinal; + StaticRound7: cardinal; //Scores - TextScoreTeam1: Cardinal; - TextScoreTeam2: Cardinal; - TextScoreTeam3: Cardinal; - TextNameTeam1: Cardinal; - TextNameTeam2: Cardinal; - TextNameTeam3: Cardinal; + TextScoreTeam1: cardinal; + TextScoreTeam2: cardinal; + TextScoreTeam3: cardinal; + TextNameTeam1: cardinal; + TextNameTeam2: cardinal; + TextNameTeam3: cardinal; - TextTeam1Players: Cardinal; - TextTeam2Players: Cardinal; - TextTeam3Players: Cardinal; - - StaticTeam1: Cardinal; - StaticTeam2: Cardinal; - StaticTeam3: Cardinal; - StaticNextPlayer1: Cardinal; - StaticNextPlayer2: Cardinal; - StaticNextPlayer3: Cardinal; + TextTeam1Players: cardinal; + TextTeam2Players: cardinal; + TextTeam3Players: cardinal; + StaticTeam1: cardinal; + StaticTeam2: cardinal; + StaticTeam3: cardinal; + StaticNextPlayer1: cardinal; + StaticNextPlayer2: cardinal; + StaticNextPlayer3: cardinal; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses UGraphic, - UMain, - UIni, - UTexture, - UParty, - UDLLManager, - ULanguage, - USong, - ULog; - -function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UMain, + UIni, + UTexture, + UParty, + UDLLManager, + ULanguage, + USong, + ULog; + +function TScreenPartyNewRound.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -211,19 +217,19 @@ end; procedure TScreenPartyNewRound.onShow; var - I: Integer; - function GetTeamPlayers(const Num: Byte): String; + I: integer; + function GetTeamPlayers(const Num: byte): string; var - Players: Array of String; - J: Byte; + Players: array of string; + J: byte; begin if (Num-1 >= PartySession.Teams.NumTeams) then exit; - //Create Players Array + //Create Players array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); - For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do + Players[J] := string(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); //Implode and Return Result := Language.Implode(Players); @@ -237,9 +243,9 @@ begin I := Length(PartySession.Rounds); if (I >= 1) then begin - Static[StaticRound1].Visible := True; - Text[TextRound1].Visible := True; - Text[TextWinner1].Visible := True; + Static[StaticRound1].Visible := true; + Text[TextRound1].Visible := true; + Text[TextWinner1].Visible := true; //Texts: Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); @@ -247,16 +253,16 @@ begin end else begin - Static[StaticRound1].Visible := False; - Text[TextRound1].Visible := False; - Text[TextWinner1].Visible := False; + Static[StaticRound1].Visible := false; + Text[TextRound1].Visible := false; + Text[TextWinner1].Visible := false; end; if (I >= 2) then begin - Static[StaticRound2].Visible := True; - Text[TextRound2].Visible := True; - Text[TextWinner2].Visible := True; + Static[StaticRound2].Visible := true; + Text[TextRound2].Visible := true; + Text[TextWinner2].Visible := true; //Texts: Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); @@ -264,16 +270,16 @@ begin end else begin - Static[StaticRound2].Visible := False; - Text[TextRound2].Visible := False; - Text[TextWinner2].Visible := False; + Static[StaticRound2].Visible := false; + Text[TextRound2].Visible := false; + Text[TextWinner2].Visible := false; end; if (I >= 3) then begin - Static[StaticRound3].Visible := True; - Text[TextRound3].Visible := True; - Text[TextWinner3].Visible := True; + Static[StaticRound3].Visible := true; + Text[TextRound3].Visible := true; + Text[TextWinner3].Visible := true; //Texts: Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); @@ -281,16 +287,16 @@ begin end else begin - Static[StaticRound3].Visible := False; - Text[TextRound3].Visible := False; - Text[TextWinner3].Visible := False; + Static[StaticRound3].Visible := false; + Text[TextRound3].Visible := false; + Text[TextWinner3].Visible := false; end; if (I >= 4) then begin - Static[StaticRound4].Visible := True; - Text[TextRound4].Visible := True; - Text[TextWinner4].Visible := True; + Static[StaticRound4].Visible := true; + Text[TextRound4].Visible := true; + Text[TextWinner4].Visible := true; //Texts: Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); @@ -298,16 +304,16 @@ begin end else begin - Static[StaticRound4].Visible := False; - Text[TextRound4].Visible := False; - Text[TextWinner4].Visible := False; + Static[StaticRound4].Visible := false; + Text[TextRound4].Visible := false; + Text[TextWinner4].Visible := false; end; if (I >= 5) then begin - Static[StaticRound5].Visible := True; - Text[TextRound5].Visible := True; - Text[TextWinner5].Visible := True; + Static[StaticRound5].Visible := true; + Text[TextRound5].Visible := true; + Text[TextWinner5].Visible := true; //Texts: Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); @@ -315,16 +321,16 @@ begin end else begin - Static[StaticRound5].Visible := False; - Text[TextRound5].Visible := False; - Text[TextWinner5].Visible := False; + Static[StaticRound5].Visible := false; + Text[TextRound5].Visible := false; + Text[TextWinner5].Visible := false; end; if (I >= 6) then begin - Static[StaticRound6].Visible := True; - Text[TextRound6].Visible := True; - Text[TextWinner6].Visible := True; + Static[StaticRound6].Visible := true; + Text[TextRound6].Visible := true; + Text[TextWinner6].Visible := true; //Texts: Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); @@ -332,16 +338,16 @@ begin end else begin - Static[StaticRound6].Visible := False; - Text[TextRound6].Visible := False; - Text[TextWinner6].Visible := False; + Static[StaticRound6].Visible := false; + Text[TextRound6].Visible := false; + Text[TextWinner6].Visible := false; end; if (I >= 7) then begin - Static[StaticRound7].Visible := True; - Text[TextRound7].Visible := True; - Text[TextWinner7].Visible := True; + Static[StaticRound7].Visible := true; + Text[TextRound7].Visible := true; + Text[TextWinner7].Visible := true; //Texts: Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); @@ -349,73 +355,73 @@ begin end else begin - Static[StaticRound7].Visible := False; - Text[TextRound7].Visible := False; - Text[TextWinner7].Visible := False; + Static[StaticRound7].Visible := false; + Text[TextRound7].Visible := false; + Text[TextWinner7].Visible := false; end; //Display Scores if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); + Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[0].Name); Text[TextTeam1Players].Text := GetTeamPlayers(1); - Text[TextScoreTeam1].Visible := True; - Text[TextNameTeam1].Visible := True; - Text[TextTeam1Players].Visible := True; - Static[StaticTeam1].Visible := True; - Static[StaticNextPlayer1].Visible := True; + Text[TextScoreTeam1].Visible := true; + Text[TextNameTeam1].Visible := true; + Text[TextTeam1Players].Visible := true; + Static[StaticTeam1].Visible := true; + Static[StaticNextPlayer1].Visible := true; end else begin - Text[TextScoreTeam1].Visible := False; - Text[TextNameTeam1].Visible := False; - Text[TextTeam1Players].Visible := False; - Static[StaticTeam1].Visible := False; - Static[StaticNextPlayer1].Visible := False; + Text[TextScoreTeam1].Visible := false; + Text[TextNameTeam1].Visible := false; + Text[TextTeam1Players].Visible := false; + Static[StaticTeam1].Visible := false; + Static[StaticNextPlayer1].Visible := false; end; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); + Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[1].Name); Text[TextTeam2Players].Text := GetTeamPlayers(2); - Text[TextScoreTeam2].Visible := True; - Text[TextNameTeam2].Visible := True; - Text[TextTeam2Players].Visible := True; - Static[StaticTeam2].Visible := True; - Static[StaticNextPlayer2].Visible := True; + Text[TextScoreTeam2].Visible := true; + Text[TextNameTeam2].Visible := true; + Text[TextTeam2Players].Visible := true; + Static[StaticTeam2].Visible := true; + Static[StaticNextPlayer2].Visible := true; end else begin - Text[TextScoreTeam2].Visible := False; - Text[TextNameTeam2].Visible := False; - Text[TextTeam2Players].Visible := False; - Static[StaticTeam2].Visible := False; - Static[StaticNextPlayer2].Visible := False; + Text[TextScoreTeam2].Visible := false; + Text[TextNameTeam2].Visible := false; + Text[TextTeam2Players].Visible := false; + Static[StaticTeam2].Visible := false; + Static[StaticNextPlayer2].Visible := false; end; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); + Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[2].Name); Text[TextTeam3Players].Text := GetTeamPlayers(3); - Text[TextScoreTeam3].Visible := True; - Text[TextNameTeam3].Visible := True; - Text[TextTeam3Players].Visible := True; - Static[StaticTeam3].Visible := True; - Static[StaticNextPlayer3].Visible := True; + Text[TextScoreTeam3].Visible := true; + Text[TextNameTeam3].Visible := true; + Text[TextTeam3Players].Visible := true; + Static[StaticTeam3].Visible := true; + Static[StaticNextPlayer3].Visible := true; end else begin - Text[TextScoreTeam3].Visible := False; - Text[TextNameTeam3].Visible := False; - Text[TextTeam3Players].Visible := False; - Static[StaticTeam3].Visible := False; - Static[StaticNextPlayer3].Visible := False; + Text[TextScoreTeam3].Visible := false; + Text[TextNameTeam3].Visible := false; + Text[TextTeam3Players].Visible := false; + Static[StaticTeam3].Visible := false; + Static[StaticNextPlayer3].Visible := false; end; //nextRound Texts @@ -424,26 +430,26 @@ begin if (PartySession.Teams.NumTeams >= 1) then begin Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; - Text[TextNextPlayer1].Visible := True; + Text[TextNextPlayer1].Visible := true; end else - Text[TextNextPlayer1].Visible := False; + Text[TextNextPlayer1].Visible := false; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; - Text[TextNextPlayer2].Visible := True; + Text[TextNextPlayer2].Visible := true; end else - Text[TextNextPlayer2].Visible := False; + Text[TextNextPlayer2].Visible := false; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; - Text[TextNextPlayer3].Visible := True; + Text[TextNextPlayer3].Visible := true; end else - Text[TextNextPlayer3].Visible := False; + Text[TextNextPlayer3].Visible := false; end; procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 147cb80f..5f7f1d9e 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -124,11 +124,11 @@ begin // Don't start when SinglePlayer Teams but only Multiplayer Plugins available OnlyMultiPlayer := true; for I := 0 to High(DLLMan.Plugins) do - begin + begin OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly); end; if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then - begin + begin ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); Exit; end; @@ -136,7 +136,6 @@ begin Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; - //Save Num Teams: PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; @@ -256,7 +255,8 @@ begin end; procedure TScreenPartyOptions.SetPlaylist2; -var I: integer; +var + I: integer; begin case Playlist of 0: diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index ea8e8bc5..c2070fce 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -45,26 +45,26 @@ uses type TScreenPartyPlayer = class(TMenu) public - Team1Name: Cardinal; - Player1Name: Cardinal; - Player2Name: Cardinal; - Player3Name: Cardinal; - Player4Name: Cardinal; - - Team2Name: Cardinal; - Player5Name: Cardinal; - Player6Name: Cardinal; - Player7Name: Cardinal; - Player8Name: Cardinal; - - Team3Name: Cardinal; - Player9Name: Cardinal; - Player10Name: Cardinal; - Player11Name: Cardinal; - Player12Name: Cardinal; + Team1Name: cardinal; + Player1Name: cardinal; + Player2Name: cardinal; + Player3Name: cardinal; + Player4Name: cardinal; + + Team2Name: cardinal; + Player5Name: cardinal; + Player6Name: cardinal; + Player7Name: cardinal; + Player8Name: cardinal; + + Team3Name: cardinal; + Player9Name: cardinal; + Player10Name: cardinal; + Player11Name: cardinal; + Player12Name: cardinal; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -78,7 +78,7 @@ uses UTexture, UParty; -function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var SDL_ModState: word; I, J: integer; @@ -315,9 +315,9 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - If (PartySession.Teams.NumTeams>=1) then + if (PartySession.Teams.NumTeams>=1) then begin - Button[0].Visible := True; + Button[0].Visible := true; Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); @@ -325,16 +325,16 @@ begin end else begin - Button[0].Visible := False; - Button[1].Visible := False; - Button[2].Visible := False; - Button[3].Visible := False; - Button[4].Visible := False; + Button[0].Visible := false; + Button[1].Visible := false; + Button[2].Visible := false; + Button[3].Visible := false; + Button[4].Visible := false; end; - If (PartySession.Teams.NumTeams>=2) then + if (PartySession.Teams.NumTeams>=2) then begin - Button[5].Visible := True; + Button[5].Visible := true; Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); @@ -342,16 +342,16 @@ begin end else begin - Button[5].Visible := False; - Button[6].Visible := False; - Button[7].Visible := False; - Button[8].Visible := False; - Button[9].Visible := False; + Button[5].Visible := false; + Button[6].Visible := false; + Button[7].Visible := false; + Button[8].Visible := false; + Button[9].Visible := false; end; - If (PartySession.Teams.NumTeams>=3) then + if (PartySession.Teams.NumTeams>=3) then begin - Button[10].Visible := True; + Button[10].Visible := true; Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); @@ -359,11 +359,11 @@ begin end else begin - Button[10].Visible := False; - Button[11].Visible := False; - Button[12].Visible := False; - Button[13].Visible := False; - Button[14].Visible := False; + Button[10].Visible := false; + Button[11].Visible := false; + Button[12].Visible := false; + Button[13].Visible := false; + Button[14].Visible := false; end; end; diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 87b4a886..23cf666d 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -34,49 +34,61 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + SysUtils, + UThemes; type TScreenPartyScore = class(TMenu) public - TextScoreTeam1: Cardinal; - TextScoreTeam2: Cardinal; - TextScoreTeam3: Cardinal; - TextNameTeam1: Cardinal; - TextNameTeam2: Cardinal; - TextNameTeam3: Cardinal; - StaticTeam1: Cardinal; - StaticTeam1BG: Cardinal; - StaticTeam1Deco: Cardinal; - StaticTeam2: Cardinal; - StaticTeam2BG: Cardinal; - StaticTeam2Deco: Cardinal; - StaticTeam3: Cardinal; - StaticTeam3BG: Cardinal; - StaticTeam3Deco: Cardinal; - TextWinner: Cardinal; - - DecoTex: Array[0..5] of Integer; - DecoColor: Array[0..5] of Record - R, G, B: Real; + TextScoreTeam1: cardinal; + TextScoreTeam2: cardinal; + TextScoreTeam3: cardinal; + TextNameTeam1: cardinal; + TextNameTeam2: cardinal; + TextNameTeam3: cardinal; + StaticTeam1: cardinal; + StaticTeam1BG: cardinal; + StaticTeam1Deco: cardinal; + StaticTeam2: cardinal; + StaticTeam2BG: cardinal; + StaticTeam2Deco: cardinal; + StaticTeam3: cardinal; + StaticTeam3BG: cardinal; + StaticTeam3Deco: cardinal; + TextWinner: cardinal; + + DecoTex: array[0..5] of integer; + DecoColor: array[0..5] of Record + R, G, B: real; end; - MaxScore: Word; + MaxScore: word; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage, UTexture, USkins; - -function TScreenPartyScore.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UMain, + UParty, + UScreenSingModi, + ULanguage, + UTexture, + USkins; + +function TScreenPartyScore.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -118,8 +130,8 @@ constructor TScreenPartyScore.Create; var // I: integer; // Auto Removed, Unused Variable Tex: TTexture; - R, G, B: Real; - Color: Integer; + R, G, B: real; + Color: integer; begin inherited Create; @@ -184,12 +196,11 @@ end; procedure TScreenPartyScore.onShow; var - I, J: Integer; - Placings: Array [0..5] of Byte; + I, J: integer; + Placings: array [0..5] of byte; begin inherited; - //Get Maxscore MaxScore := 0; @@ -204,11 +215,10 @@ begin begin Placings[I] := 0; for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do - If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then + if (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then Inc(Placings[I]); end; - //Set Static Length Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; @@ -228,7 +238,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); - Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + Text[TextNameTeam1].Text := string(ScreenSingModi.TeamInfo.Teaminfo[0].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -239,25 +249,25 @@ begin Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; end; - Text[TextScoreTeam1].Visible := True; - Text[TextNameTeam1].Visible := True; - Static[StaticTeam1].Visible := True; - Static[StaticTeam1BG].Visible := True; - Static[StaticTeam1Deco].Visible := True; + Text[TextScoreTeam1].Visible := true; + Text[TextNameTeam1].Visible := true; + Static[StaticTeam1].Visible := true; + Static[StaticTeam1BG].Visible := true; + Static[StaticTeam1Deco].Visible := true; end else begin - Text[TextScoreTeam1].Visible := False; - Text[TextNameTeam1].Visible := False; - Static[StaticTeam1].Visible := False; - Static[StaticTeam1BG].Visible := False; - Static[StaticTeam1Deco].Visible := False; + Text[TextScoreTeam1].Visible := false; + Text[TextNameTeam1].Visible := false; + Static[StaticTeam1].Visible := false; + Static[StaticTeam1BG].Visible := false; + Static[StaticTeam1Deco].Visible := false; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); - Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + Text[TextNameTeam2].Text := string(ScreenSingModi.TeamInfo.Teaminfo[1].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -268,25 +278,25 @@ begin Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; end; - Text[TextScoreTeam2].Visible := True; - Text[TextNameTeam2].Visible := True; - Static[StaticTeam2].Visible := True; - Static[StaticTeam2BG].Visible := True; - Static[StaticTeam2Deco].Visible := True; + Text[TextScoreTeam2].Visible := true; + Text[TextNameTeam2].Visible := true; + Static[StaticTeam2].Visible := true; + Static[StaticTeam2BG].Visible := true; + Static[StaticTeam2Deco].Visible := true; end else begin - Text[TextScoreTeam2].Visible := False; - Text[TextNameTeam2].Visible := False; - Static[StaticTeam2].Visible := False; - Static[StaticTeam2BG].Visible := False; - Static[StaticTeam2Deco].Visible := False; + Text[TextScoreTeam2].Visible := false; + Text[TextNameTeam2].Visible := false; + Static[StaticTeam2].Visible := false; + Static[StaticTeam2BG].Visible := false; + Static[StaticTeam2Deco].Visible := false; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); - Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + Text[TextNameTeam3].Text := string(ScreenSingModi.TeamInfo.Teaminfo[2].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -297,19 +307,19 @@ begin Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; end; - Text[TextScoreTeam3].Visible := True; - Text[TextNameTeam3].Visible := True; - Static[StaticTeam3].Visible := True; - Static[StaticTeam3BG].Visible := True; - Static[StaticTeam3Deco].Visible := True; + Text[TextScoreTeam3].Visible := true; + Text[TextNameTeam3].Visible := true; + Static[StaticTeam3].Visible := true; + Static[StaticTeam3BG].Visible := true; + Static[StaticTeam3Deco].Visible := true; end else begin - Text[TextScoreTeam3].Visible := False; - Text[TextNameTeam3].Visible := False; - Static[StaticTeam3].Visible := False; - Static[StaticTeam3BG].Visible := False; - Static[StaticTeam3Deco].Visible := False; + Text[TextScoreTeam3].Visible := false; + Text[TextNameTeam3].Visible := false; + Static[StaticTeam3].Visible := false; + Static[StaticTeam3BG].Visible := false; + Static[StaticTeam3Deco].Visible := false; end; end; diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 64a50737..3c105c7d 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -34,42 +34,51 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, SysUtils, UThemes; + UMenu, + SDL, UDisplay, + UMusic, + SysUtils, + UThemes; type TScreenPartyWin = class(TMenu) public - TextScoreTeam1: Cardinal; - TextScoreTeam2: Cardinal; - TextScoreTeam3: Cardinal; - TextNameTeam1: Cardinal; - TextNameTeam2: Cardinal; - TextNameTeam3: Cardinal; - StaticTeam1: Cardinal; - StaticTeam1BG: Cardinal; - StaticTeam1Deco: Cardinal; - StaticTeam2: Cardinal; - StaticTeam2BG: Cardinal; - StaticTeam2Deco: Cardinal; - StaticTeam3: Cardinal; - StaticTeam3BG: Cardinal; - StaticTeam3Deco: Cardinal; - TextWinner: Cardinal; + TextScoreTeam1: cardinal; + TextScoreTeam2: cardinal; + TextScoreTeam3: cardinal; + TextNameTeam1: cardinal; + TextNameTeam2: cardinal; + TextNameTeam3: cardinal; + StaticTeam1: cardinal; + StaticTeam1BG: cardinal; + StaticTeam1Deco: cardinal; + StaticTeam2: cardinal; + StaticTeam2BG: cardinal; + StaticTeam2Deco: cardinal; + StaticTeam3: cardinal; + StaticTeam3BG: cardinal; + StaticTeam3Deco: cardinal; + TextWinner: cardinal; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses UGraphic, UMain, UParty, UScreenSingModi, ULanguage; +uses + UGraphic, + UMain, + UParty, + UScreenSingModi, + ULanguage; -function TScreenPartyWin.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenPartyWin.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -128,12 +137,12 @@ end; procedure TScreenPartyWin.onShow; var - I: Integer; + I: integer; Placing: TeamOrderArray; - Function GetTeamColor(Team: Byte): Cardinal; + Function GetTeamColor(Team: byte): cardinal; var - NameString: String; + NameString: string; begin NameString := 'P' + InttoStr(Team+1) + 'Dark'; @@ -151,16 +160,16 @@ begin if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); - Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); + Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[Placing[0]].Name); - Text[TextScoreTeam1].Visible := True; - Text[TextNameTeam1].Visible := True; - Static[StaticTeam1].Visible := True; - Static[StaticTeam1BG].Visible := True; - Static[StaticTeam1Deco].Visible := True; + Text[TextScoreTeam1].Visible := true; + Text[TextNameTeam1].Visible := true; + Static[StaticTeam1].Visible := true; + Static[StaticTeam1BG].Visible := true; + Static[StaticTeam1Deco].Visible := true; //Set Static Color to Team Color - If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[0]); if (I <> -1) then @@ -171,7 +180,7 @@ begin end; end; - If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then begin I := GetTeamColor(Placing[0]); if (I <> -1) then @@ -184,26 +193,26 @@ begin end else begin - Text[TextScoreTeam1].Visible := False; - Text[TextNameTeam1].Visible := False; - Static[StaticTeam1].Visible := False; - Static[StaticTeam1BG].Visible := False; - Static[StaticTeam1Deco].Visible := False; + Text[TextScoreTeam1].Visible := false; + Text[TextNameTeam1].Visible := false; + Static[StaticTeam1].Visible := false; + Static[StaticTeam1BG].Visible := false; + Static[StaticTeam1Deco].Visible := false; end; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); - Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name); + Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[Placing[1]].Name); - Text[TextScoreTeam2].Visible := True; - Text[TextNameTeam2].Visible := True; - Static[StaticTeam2].Visible := True; - Static[StaticTeam2BG].Visible := True; - Static[StaticTeam2Deco].Visible := True; + Text[TextScoreTeam2].Visible := true; + Text[TextNameTeam2].Visible := true; + Static[StaticTeam2].Visible := true; + Static[StaticTeam2BG].Visible := true; + Static[StaticTeam2Deco].Visible := true; //Set Static Color to Team Color - If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[1]); if (I <> -1) then @@ -214,7 +223,7 @@ begin end; end; - If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then begin I := GetTeamColor(Placing[1]); if (I <> -1) then @@ -227,26 +236,26 @@ begin end else begin - Text[TextScoreTeam2].Visible := False; - Text[TextNameTeam2].Visible := False; - Static[StaticTeam2].Visible := False; - Static[StaticTeam2BG].Visible := False; - Static[StaticTeam2Deco].Visible := False; + Text[TextScoreTeam2].Visible := false; + Text[TextNameTeam2].Visible := false; + Static[StaticTeam2].Visible := false; + Static[StaticTeam2BG].Visible := false; + Static[StaticTeam2Deco].Visible := false; end; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); - Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name); + Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[Placing[2]].Name); - Text[TextScoreTeam3].Visible := True; - Text[TextNameTeam3].Visible := True; - Static[StaticTeam3].Visible := True; - Static[StaticTeam3BG].Visible := True; - Static[StaticTeam3Deco].Visible := True; + Text[TextScoreTeam3].Visible := true; + Text[TextNameTeam3].Visible := true; + Static[StaticTeam3].Visible := true; + Static[StaticTeam3BG].Visible := true; + Static[StaticTeam3Deco].Visible := true; //Set Static Color to Team Color - If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[2]); if (I <> -1) then @@ -257,7 +266,7 @@ begin end; end; - If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then + if (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then begin I := GetTeamColor(Placing[2]); if (I <> -1) then @@ -270,11 +279,11 @@ begin end else begin - Text[TextScoreTeam3].Visible := False; - Text[TextNameTeam3].Visible := False; - Static[StaticTeam3].Visible := False; - Static[StaticTeam3BG].Visible := False; - Static[StaticTeam3Deco].Visible := False; + Text[TextScoreTeam3].Visible := false; + Text[TextNameTeam3].Visible := false; + Static[StaticTeam3].Visible := false; + Static[StaticTeam3BG].Visible := false; + Static[StaticTeam3Deco].Visible := false; end; end; diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index bf4752b9..7e4671d6 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -34,48 +34,60 @@ interface {$I switches.inc} uses - UMenu, SDL, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenPopupCheck = class(TMenu) public - Visible: Boolean; //Whether the Menu should be Drawn + Visible: boolean; //Whether the Menu should be Drawn constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; - procedure ShowPopup(msg: String); + procedure ShowPopup(msg: string); function Draw: boolean; override; end; type TScreenPopupError = class(TMenu) { private - CurMenu: Byte; //Num of the cur. Shown Menu} + CurMenu: byte; //Num of the cur. Shown Menu} public - Visible: Boolean; //Whether the Menu should be Drawn + Visible: boolean; //Whether the Menu should be Drawn constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure onHide; override; - procedure ShowPopup(msg: String); + procedure ShowPopup(msg: string); function Draw: boolean; override; end; var -// ISelections: Array of String; - SelectValue: Integer; - +// ISelections: array of string; + SelectValue: integer; implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, UPlaylist, UDisplay; - -function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + UPlaylist, + UDisplay; + +function TScreenPopupCheck.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -91,9 +103,9 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Display.CheckOK:=False; - Display.NextScreenWithCheck:=NIL; - Visible:=False; + Display.CheckOK := false; + Display.NextScreenWithCheck := NIL; + Visible := false; Result := false; end; @@ -110,14 +122,14 @@ begin ScreenSingModi.Finish; end; - Display.CheckOK:=True; + Display.CheckOK := true; end; 1: begin - Display.CheckOK:=False; - Display.NextScreenWithCheck:=NIL; + Display.CheckOK := false; + Display.NextScreenWithCheck := NIL; end; end; - Visible:=False; + Visible := false; Result := false; end; @@ -159,15 +171,15 @@ begin inherited; end; -procedure TScreenPopupCheck.ShowPopup(msg: String); +procedure TScreenPopupCheck.ShowPopup(msg: string); begin Interaction := 0; //Reset Interaction - Visible := True; //Set Visible + Visible := true; //Set Visible Text[0].Text := Language.Translate(msg); - Button[0].Visible := True; - Button[1].Visible := True; + Button[0].Visible := true; + Button[1].Visible := true; Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); @@ -177,10 +189,10 @@ end; // error popup -function TScreenPopupError.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenPopupError.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down case PressedKey of @@ -192,13 +204,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Visible:=False; + Visible := false; Result := false; end; SDLK_RETURN: begin - Visible:=False; + Visible := false; Result := false; end; @@ -228,7 +240,7 @@ end; function TScreenPopupError.Draw: boolean; begin - Draw:=inherited Draw; + Draw := inherited Draw; end; procedure TScreenPopupError.onShow; @@ -241,26 +253,26 @@ procedure TScreenPopupError.onHide; begin end; -procedure TScreenPopupError.ShowPopup(msg: String); +procedure TScreenPopupError.ShowPopup(msg: string); begin Interaction := 0; //Reset Interaction - Visible := True; //Set Visible + Visible := true; //Set Visible Background.OnShow; { //dirty hack... Text[0] is invisible for some strange reason for i:=1 to high(Text) do if i-1 <= high(msg) then begin - Text[i].Visible:=True; + Text[i].Visible := true; Text[i].Text := msg[i-1]; end else begin - Text[i].Visible:=False; + Text[i].Visible := false; end;} - Text[0].Text:=msg; + Text[0].Text := msg; - Button[0].Visible := True; + Button[0].Visible := true; Button[0].Text[0].Text := 'OK'; end; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b5b93831..c29c0e2c 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -743,10 +743,9 @@ begin begin // Just call this once // when Screens = 2 - If (ScreenAct = 1) then + if (ScreenAct = 1) then fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index 9108cd71..eeb06004 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -33,45 +33,45 @@ interface {$I switches.inc} - -uses UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - gl, - - UThemes, - UScreenSing, - ModiSDK; +uses + UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + + UThemes, + UScreenSing, + ModiSDK; type TScreenSingModi = class(TScreenSing) protected public - Winner: Byte; //Who Wins + Winner: byte; //Who Wins PlayerInfo: TPlayerInfo; TeamInfo: TTeamInfo; constructor Create; override; procedure onShow; override; //procedure onShowFinish; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure Finish; override; end; type TCustomSoundEntry = record - Filename : String; + Filename : string; Stream : TAudioPlaybackStream; end; @@ -85,13 +85,13 @@ function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; //function Translate (const Name: PChar): PChar; // {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Procedure to Print Text -procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); +procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): Cardinal; +function LoadSound(const Name: PChar): cardinal; {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Plays a Custom Sound -procedure PlaySound(const Index: Cardinal); +procedure PlaySound(const Index: cardinal); {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} //Utilys @@ -112,12 +112,12 @@ uses URecord, USkins; -// Method for input parsing. If False is returned, GetNextWindow +// Method for input parsing. If false is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down case PressedKey of @@ -143,7 +143,7 @@ end; function ToSentences(Const Lines: TLines): TSentences; var - I, J: Integer; + I, J: integer; begin Result.Current := Lines.Current; Result.High := Lines.High; @@ -178,7 +178,7 @@ end; procedure TScreenSingModi.onShow; var - I: Integer; + I: integer; begin inherited; @@ -200,14 +200,14 @@ begin PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); PlayerInfo.Playerinfo[I].Score := 0; PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := True; + 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; + PlayerInfo.Playerinfo[I].Enabled := false; end; {Case PlayersPlay of @@ -254,7 +254,7 @@ begin end; // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then + if (DLLMan.Selected.LoadBack) and (DLLMan.Selected.LoadSong) then ScreenSing.Tex_Background := Tex_Background; Winner := 0; @@ -262,12 +262,14 @@ begin //Set Score Visibility Scores.Visible := DLLMan.Selected.ShowScore; - {if PlayersPlay = 1 then begin + {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 + if (PlayersPlay = 2) or (PlayersPlay = 4) then + begin Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -275,7 +277,8 @@ begin Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; end; - if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin + if (PlayersPlay = 3) or (PlayersPlay = 6) then + begin Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -316,11 +319,12 @@ begin // draw background picture (if any, and if no visualizations) // when we don't check for visualizations the visualizations would // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer - if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) AND (not fShowVisualization) then + if (DllMan.Selected.LoadSong) and (DllMan.Selected.LoadBack) and (not fShowVisualization) then SingDrawBackground; // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then begin + 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 @@ -329,7 +333,8 @@ begin Text[TextP3R].Text := 'P3'; end - Else if ScreenAct = 2 then begin + Else if ScreenAct = 2 then + begin case PlayersPlay of 4: begin Text[TextP1TwoP].Text := 'P3'; @@ -343,7 +348,6 @@ begin end; // case end; // if - // stereo <- and where iss P2M? or P3? Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; Text[TextP1].X := Text[TextP1].X + 10*ScreenX; @@ -375,7 +379,8 @@ begin end; // update and draw movie -{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin +{ if ShowFinish and CurrentSong.VideoLoaded and DllMan.Selected.LoadVideo then + begin UpdateSmpeg; // this only draws end;} @@ -386,10 +391,9 @@ begin begin // Just call this once // when Screens = 2 - If (ScreenAct = 1) then + if (ScreenAct = 1) then fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; @@ -397,15 +401,20 @@ begin // draw static menu (FG) DrawFG; - if ShowFinish then begin + if ShowFinish then + begin if DllMan.Selected.LoadSong then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then + begin //Pause Mod: if not Paused then Sing(Self); // analyze song - end else begin - if not FadeOut then begin + end + else + begin + if not FadeOut then + begin Finish; FadeOut := true; FadeTo(@ScreenPartyScore); @@ -434,14 +443,15 @@ begin end; end; - if ((ShowFinish) AND (NOT Paused)) then + if ((ShowFinish) and (not Paused)) then begin if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) then begin - if not FadeOut then begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); + if not FadeOut then + begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); end; end; end; @@ -465,14 +475,12 @@ begin {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} - for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; @@ -495,11 +503,11 @@ end; function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; var - Texname, EXT: String; + Texname, EXT: string; Tex: TTexture; begin //Get texture Name - TexName := Skin.GetTextureFileName(String(Name)); + TexName := Skin.GetTextureFileName(string(Name)); //Get File Typ Ext := ExtractFileExt(TexName); if (uppercase(Ext) = '.JPG') then @@ -516,11 +524,11 @@ end; { function Translate (const Name: PChar): PChar; stdcall; begin - Result := PChar(Language.Translate(String(Name))); + Result := PChar(Language.Translate(string(Name))); end; } //Procedure to Print Text -procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); +procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); @@ -528,15 +536,15 @@ begin // used by Hold_The_Line / TeamDuell SetFontSize(Size); SetFontPos (X, Y); - glPrint (Language.Translate(String(Text))); + glPrint (Language.Translate(string(Text))); end; //Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): Cardinal; +function LoadSound(const Name: PChar): cardinal; var Stream: TAudioPlaybackStream; - i: Integer; - Filename: String; + i: integer; + Filename: string; begin //Search for Sound in already loaded Sounds Filename := UpperCase(SoundPath + Name); @@ -549,7 +557,7 @@ begin end; end; - Stream := AudioPlayback.OpenSound(SoundPath + String(Name)); + Stream := AudioPlayback.OpenSound(SoundPath + string(Name)); if (Stream = nil) then begin Result := 0; @@ -562,7 +570,7 @@ begin end; //Plays a Custom Sound -procedure PlaySound(const Index: Cardinal); +procedure PlaySound(const Index: cardinal); begin if (Index <= High(CustomSounds)) then AudioPlayback.PlaySound(CustomSounds[Index].Stream); diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 8f6fafea..8f4dd5da 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -33,7 +33,6 @@ interface {$I switches.inc} - uses UMenu, SDL, @@ -111,7 +110,6 @@ type StaticNonParty: array of cardinal; TextNonParty: array of cardinal; - constructor Create; override; procedure SetScroll; //procedure SetScroll1; @@ -142,7 +140,7 @@ type //procedures for Menu procedure StartSong; procedure OpenEditor; - procedure DoJoker(Team: Byte); + procedure DoJoker(Team: byte); procedure SelectPlayers; procedure UnloadDetailedCover; @@ -242,14 +240,13 @@ begin end; //Show Cat in Top Left Mod End - -// Method for input parsing. If False is returned, GetNextWindow +// Method for input parsing. If false is returned, GetNextWindow // should be checked to know the next window to load; function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; var I: integer; I2: integer; - SDL_ModState: Word; + SDL_ModState: word; Letter: WideChar; begin Result := true; @@ -455,7 +452,7 @@ begin //Fix: Not Existing Song selected: //if (I+1=I2) then - Inc(I2); + Inc(I2); //Choose Song SkipTo(I2-I); @@ -504,7 +501,6 @@ begin //Show Cat in Top Left Mod HideCatTL; - //Show Wrong Song when Tabs on Fix SelectNext; FixSelected; @@ -610,7 +606,7 @@ begin begin I := Interaction; if I <= 0 then - I := 1; + I := 1; while not catsongs.Song[I].Main do begin @@ -652,7 +648,7 @@ begin I := Interaction; I2 := 0; if I <= 0 then - I := 1; + I := 1; while not catsongs.Song[I].Main or (I2 = 0) do begin @@ -802,7 +798,6 @@ begin GenerateThumbnails(); - // Randomize Patch Randomize; @@ -957,7 +952,6 @@ begin if CatSongs.Song[B].Visible then Inc(VisInt); - if VisCount <= 6 then begin Typ := 0; @@ -986,7 +980,6 @@ begin end; - // hide all buttons for B := 0 to High(Button) do begin @@ -1004,7 +997,6 @@ begin end; } - if Typ = 0 then begin for B := 0 to High(Button) do @@ -1301,20 +1293,19 @@ begin if Button[B].Visible then // optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed begin - Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms - - Z := (1 + cos(Factor)) / 2; - Z2 := (1 + 2*Z) / 3; + Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + Z := (1 + cos(Factor)) / 2; + Z2 := (1 + 2*Z) / 3; - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * 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].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * 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].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; + //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 @@ -1349,7 +1340,6 @@ begin 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; @@ -1359,9 +1349,9 @@ begin // limit-bg-covers hack if (abs(VS/2-abs(Pos))>10) then - Button[B].Visible := false; + Button[B].Visible := false; if VS > 25 then - VS:=25; + VS:=25; // end of limit-bg-covers hack if Pos < 0 then @@ -1379,7 +1369,6 @@ begin 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); @@ -1389,7 +1378,6 @@ begin end; end; - procedure TScreenSong.onShow; begin inherited; @@ -1453,7 +1441,7 @@ begin AudioPlayback.SetVolume(1.0); // if preview is deactivated: load musicfile now - If (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then + if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); // if hide then stop music (for party mode popup on exit) @@ -1915,7 +1903,7 @@ begin end; //Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: Byte); +procedure TScreenSong.DoJoker (Team: byte); begin if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= Team + 1) and diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index a8679368..e55a6276 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -34,44 +34,59 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; type TScreenSongJumpto = class(TMenu) private //For ChangeMusic - LastPlayed: Integer; - VisibleBool: Boolean; + LastPlayed: integer; + VisibleBool: boolean; public - VisSongs: Integer; + VisSongs: integer; constructor Create; override; //Visible //Whether the Menu should be Drawn //Whether the Menu should be Drawn - procedure SetVisible(Value: Boolean); - property Visible: Boolean read VisibleBool write SetVisible; + procedure SetVisible(Value: boolean); + property Visible: boolean read VisibleBool write SetVisible; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; function Draw: boolean; override; - procedure SetTextFound(const Count: Cardinal); + procedure SetTextFound(const Count: cardinal); end; var - IType: Array [0..2] of String; - SelectType: Integer; + IType: array [0..2] of string; + SelectType: integer; implementation -uses UGraphic, UMain, UIni, UTexture, ULanguage, UParty, USongs, UScreenSong, ULog; - -function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + USongs, + UScreenSong, + ULog; + +function TScreenSongJumpto.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case CharCode of @@ -90,7 +105,7 @@ begin case PressedKey of SDLK_BACKSPACE: begin - if (Interaction = 0) AND (Length(Button[0].Text[0].Text) > 0) then + if (Interaction = 0) and (Length(Button[0].Text[0].Text) > 0) then begin Button[0].Text[0].DeleteLastL; SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); @@ -100,9 +115,9 @@ begin SDLK_RETURN, SDLK_ESCAPE: begin - Visible := False; + Visible := false; AudioPlayback.PlaySound(SoundLib.Back); - if (VisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then + if (VisSongs = 0) and (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; @@ -163,15 +178,14 @@ begin SelectType := 0; AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); - Interaction := 0; LastPlayed := 0; end; -procedure TScreenSongJumpto.SetVisible(Value: Boolean); +procedure TScreenSongJumpto.SetVisible(Value: boolean); begin //If change from unvisible to Visible then OnShow - if (VisibleBool = False) AND (Value = True) then + if (VisibleBool = false) and (Value = true) then OnShow; VisibleBool := Value; @@ -192,7 +206,7 @@ begin //Select Input Interaction := 0; - Button[0].Text[0].Selected := True; + Button[0].Text[0].Selected := true; LastPlayed := ScreenSong.Interaction; end; @@ -202,7 +216,7 @@ begin Result := inherited Draw; end; -procedure TScreenSongJumpto.SetTextFound(const Count: Cardinal); +procedure TScreenSongJumpto.SetTextFound(const Count: cardinal); begin if (Count = 0) then begin @@ -220,7 +234,6 @@ begin ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end; - //Set visSongs VisSongs := Count; diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index 8d75eb67..0af94a8f 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -193,7 +193,6 @@ begin SetLength(ISelections, 1); ISelections[0] := 'Dummy'; - AddText(Theme.SongMenu.TextMenu); LoadFromTheme(Theme.SongMenu); @@ -406,9 +405,9 @@ begin 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[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 diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 20b89b33..bbbb4a1b 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -47,21 +47,20 @@ type TScreenStatDetail = class(TMenu) public Typ: TStatType; - Page: Cardinal; - Count: Byte; - Reversed: Boolean; - - TotEntrys: Cardinal; - TotPages: Cardinal; + Page: cardinal; + Count: byte; + Reversed: boolean; + TotEntrys: cardinal; + TotPages: cardinal; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetTitle; - Procedure SetPage(NewPage: Cardinal); + Procedure SetPage(NewPage: cardinal); end; implementation @@ -73,10 +72,10 @@ uses Classes, ULog; -function TScreenStatDetail.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenStatDetail.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -97,24 +96,28 @@ begin end; SDLK_RETURN: begin - if Interaction = 0 then begin + if Interaction = 0 then + begin //Next Page SetPage(Page+1); end; - if Interaction = 1 then begin + if Interaction = 1 then + begin //Previous Page if (Page > 0) then SetPage(Page-1); end; - if Interaction = 2 then begin + if Interaction = 2 then + begin //Reverse Order Reversed := not Reversed; SetPage(Page); end; - if Interaction = 3 then begin + if Interaction = 3 then + begin AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; @@ -187,7 +190,7 @@ begin SetTitle; //Show First Page - Reversed := False; + Reversed := false; SetPage(0); end; @@ -199,12 +202,12 @@ begin Text[Count].Text := Theme.StatDetail.Description[Ord(Typ)]; end; -procedure TScreenStatDetail.SetPage(NewPage: Cardinal); +procedure TScreenStatDetail.SetPage(NewPage: cardinal); var StatList: TList; - I: Integer; - FormatStr: String; - PerPage: Byte; + I: integer; + FormatStr: string; + PerPage: byte; begin // fetch statistics StatList := Database.GetStats(Typ, Count, NewPage, Reversed); @@ -288,9 +291,9 @@ begin Database.FreeStats(StatList); end; - procedure TScreenStatDetail.SetAnimationProgress(Progress: real); -var I: Integer; +var + I: integer; begin for I := 0 to High(Button) do Button[I].Texture.ScaleW := Progress; diff --git a/src/screens/UScreenStatMain.pas b/src/screens/UScreenStatMain.pas index a6f67cab..2fd91288 100644 --- a/src/screens/UScreenStatMain.pas +++ b/src/screens/UScreenStatMain.pas @@ -46,14 +46,14 @@ type TScreenStatMain = class(TMenu) private //Some Stat Value that don't need to be calculated 2 times - SongsWithVid: Cardinal; + SongsWithVid: cardinal; function FormatOverviewIntro(FormatStr: string): string; function FormatSongOverview(FormatStr: string): string; function FormatPlayerOverview(FormatStr: string): string; public TextOverview: integer; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; @@ -62,24 +62,25 @@ type implementation -uses UGraphic, - UDataBase, - USongs, - USong, - ULanguage, - UCommon, - Classes, - {$IFDEF win32} - windows, - {$ELSE} - sysconst, - {$ENDIF} - ULog; - -function TScreenStatMain.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +uses + UGraphic, + UDataBase, + USongs, + USong, + ULanguage, + UCommon, + Classes, + {$IFDEF win32} + windows, + {$ELSE} + sysconst, + {$ENDIF} + ULog; + +function TScreenStatMain.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then + if (PressedDown) then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -168,7 +169,7 @@ begin //Set Songs with Vid SongsWithVid := 0; - For I := 0 to Songs.SongList.Count -1 do + for I := 0 to Songs.SongList.Count -1 do if (TSong(Songs.SongList[I]).Video <> '') then Inc(SongsWithVid); end; @@ -183,7 +184,7 @@ end; function TScreenStatMain.FormatOverviewIntro(FormatStr: string): string; var - Year, Month, Day: Word; + Year, Month, Day: word; begin {Format: %0:d Ultrastar Version @@ -204,8 +205,8 @@ end; function TScreenStatMain.FormatSongOverview(FormatStr: string): string; var - CntSongs, CntSungSongs, CntVidSongs: Integer; - MostPopSongArtist, MostPopSongTitle: String; + CntSongs, CntSungSongs, CntVidSongs: integer; + MostPopSongArtist, MostPopSongTitle: string; StatList: TList; MostSungSong: TStatResultMostSungSong; begin @@ -220,7 +221,7 @@ begin CntSungSongs := Database.GetTotalEntrys(stMostSungSong); CntVidSongs := SongsWithVid; - StatList := Database.GetStats(stMostSungSong, 1, 0, False); + StatList := Database.GetStats(stMostSungSong, 1, 0, false); if ((StatList <> nil) and (StatList.Count > 0)) then begin MostSungSong := StatList[0]; @@ -248,11 +249,11 @@ end; function TScreenStatMain.FormatPlayerOverview(FormatStr: string): string; var - CntPlayers: Integer; + CntPlayers: integer; BestScoreStat: TStatResultBestScores; BestSingerStat: TStatResultBestSingers; - BestPlayer, BestScorePlayer: String; - BestPlayerScore, BestScore: Integer; + BestPlayer, BestScorePlayer: string; + BestPlayerScore, BestScore: integer; SingerStats, ScoreStats: TList; begin {Format: @@ -264,7 +265,7 @@ begin CntPlayers := Database.GetTotalEntrys(stBestSingers); - SingerStats := Database.GetStats(stBestSingers, 1, 0, False); + SingerStats := Database.GetStats(stBestSingers, 1, 0, false); if ((SingerStats <> nil) and (SingerStats.Count > 0)) then begin BestSingerStat := SingerStats[0]; @@ -278,7 +279,7 @@ begin end; Database.FreeStats(SingerStats); - ScoreStats := Database.GetStats(stBestScores, 1, 0, False); + ScoreStats := Database.GetStats(stBestScores, 1, 0, false); if ((ScoreStats <> nil) and (ScoreStats.Count > 0)) then begin BestScoreStat := ScoreStats[0]; @@ -306,7 +307,7 @@ end; procedure TScreenStatMain.SetOverview; var - Overview: String; + Overview: string; begin // Format overview Overview := FormatOverviewIntro(Language.Translate('STAT_OVERVIEW_INTRO')) + '\n \n' + @@ -315,11 +316,11 @@ begin Text[0].Text := Overview; end; - procedure TScreenStatMain.SetAnimationProgress(Progress: real); -var I: Integer; +var + I: integer; begin - For I := 0 to high(Button) do + for I := 0 to high(Button) do Button[I].Texture.ScaleW := Progress; end; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index c45f01bf..23405ebb 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -90,7 +90,7 @@ begin SDLK_RETURN: begin if (not Fadeout) then - begin + begin FadeTo(@ScreenSong); Fadeout := true; end; @@ -111,7 +111,6 @@ begin LoadFromTheme(Theme.Top5); - TextLevel := AddText(Theme.Top5.TextLevel); TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas index 485ebedb..a00a84e2 100644 --- a/src/screens/UScreenWelcome.pas +++ b/src/screens/UScreenWelcome.pas @@ -34,7 +34,10 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, UThemes; + UMenu, + SDL, + SysUtils, + UThemes; type TScreenWelcome = class(TMenu) @@ -42,24 +45,29 @@ type Animation: real; Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure onShow; override; end; implementation -uses UGraphic, UTime, USkins, UTexture; +uses + UGraphic, + UTime, + USkins, + UTexture; -function TScreenWelcome.ParseInput(PressedKey: Cardinal; CharCode: WideChar; PressedDown: Boolean): Boolean; +function TScreenWelcome.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; begin Result := true; - If (PressedDown) Then begin + if (PressedDown) then + begin case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin - Result := False; + Result := false; end; SDLK_RETURN: begin @@ -102,12 +110,14 @@ begin // draw nothing Min := 0; Max := 1000; - if (Animation >= Min) and (Animation < Max) then begin + if (Animation >= Min) and (Animation < Max) then + begin end; // popup Min := 1000; Max := 1120; - if (Animation >= Min) and (Animation < Max) then begin + if (Animation >= Min) and (Animation < Max) then + begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.X := 600; Static[0].Texture.Y := 600 - Factor * 230; @@ -117,7 +127,8 @@ begin // bounce Min := 1120; Max := 1200; - if (Animation >= Min) and (Animation < Max) then begin + if (Animation >= Min) and (Animation < Max) then + begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.Y := 370 + Factor * 50; Static[0].Texture.H := 230 - Factor * 50; @@ -125,14 +136,15 @@ begin // run Min := 1500; Max := 3500; - if (Animation >= Min) and (Animation < Max) then begin + if (Animation >= Min) and (Animation < Max) then + begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.X := 600 - Factor * 1400; Static[0].Texture.H := 180; - - for Count := 1 to 5 do begin + for Count := 1 to 5 do + begin Static[Count].Texture.X := 770 - Factor * 1400; Static[Count].Texture.W := 150 + Factor * 200; Static[Count].Texture.Alpha := Factor * 0.5; @@ -140,7 +152,8 @@ begin end; Min := 3500; - if (Animation >= Min) and (not Fadeout) then begin + if (Animation >= Min) and (not Fadeout) then + begin FadeTo(@ScreenMain); Fadeout := true; end; -- cgit v1.2.3 From d14c9c3a46da40a9f4737ddc4b9cef5d94b0fe74 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 25 Apr 2009 13:52:48 +0000 Subject: Cosmetics. No code change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1695 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 544 +++++++++++++++++++++-------------------- 1 file changed, 274 insertions(+), 270 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 2982fe24..1d0e5466 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -47,7 +47,7 @@ uses UGraphicClasses; type - TCreditsStages=(InitialDelay,Intro,MainPart,Outro); + TCreditsStages=(InitialDelay, Intro, MainPart, Outro); TScreenCredits = class(TMenu) public @@ -89,14 +89,14 @@ type deluxe_slidein: cardinal; - CurrentScrollText: string; - NextScrollUpdate: real; + CurrentScrollText: string; + NextScrollUpdate: real; EndofLastScrollingPart: cardinal; CurrentScrollStart, CurrentScrollEnd: integer; CRDTS_Stage: TCreditsStages; - Fadeout: boolean; + Fadeout: boolean; constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; function Draw: boolean; override; @@ -108,8 +108,8 @@ type const Funky_Text: string = - '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 '+ + '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,..'; @@ -191,15 +191,15 @@ begin FadeTo(@ScreenMain); AudioPlayback.PlaySound(SoundLib.Back); end; - { +{ SDLK_SPACE: begin setlength(CTime_hold,length(CTime_hold)+1); CTime_hold[high(CTime_hold)]:=CTime; end; - } - end;//esac - end; //fi +} + end; // esac + end; // fi end; constructor TScreenCredits.Create; @@ -250,15 +250,15 @@ procedure TScreenCredits.onShow; begin inherited; - CRDTS_Stage := InitialDelay; - Credits_X := 580; + CRDTS_Stage := InitialDelay; + Credits_X := 580; deluxe_slidein := 0; - Credits_Alpha := 0; - //Music.SetLoop(true); loop loops not, shit + Credits_Alpha := 0; +// Music.SetLoop(true); loop loops not, shit AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); // thank you wetue - //Music.Play; - CTime:=0; - //setlength(CTime_hold,0); +// Music.Play; + CTime := 0; +// setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -268,17 +268,17 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S: integer; - X,Y,A: real; + S: integer; + X, Y, A: real; visibleText: string; begin SetFontSize(30); - //Init ScrollingText + // init ScrollingText if (CTime = Timings[7]) then begin - //Set Position of Text - Credits_X := 600; + // set position of text + Credits_X := 600; CurrentScrollStart := 1; CurrentScrollEnd := 1; end; @@ -291,8 +291,8 @@ begin for S := 1 to length(visibleText) 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); + Y := abs(sin((Credits_X + X) * 0.93 { * (((Credits_X + X)) / 1200) } / 100 * pi)); + SetFontPos(Credits_X + X, 538 - Y * (Credits_X + X) * (Credits_X + X) * (Credits_X + X) / 1000000); if (Credits_X + X > 32) then A := 17 @@ -301,10 +301,10 @@ begin else A := 0; - 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); + 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); glPrint(visibleText[S]); X := X + glTextWidth(visibleText[S]); end; @@ -323,20 +323,21 @@ begin inc(CurrentScrollEnd); end; end; - { // timing hack - X:=5; - SetFontStyle (2); - SetFontItalic(false); - SetFontSize(27); - glColor4f(1, 1, 1, 1); - for S:=0 to high(CTime_hold) do - begin - visibleText := inttostr(CTime_hold[S]); - SetFontPos (500, X); - glPrint(visibleText[0]); - X := X + 20; - end; - } +{ +// timing hack + X:=5; + SetFontStyle(2); + SetFontItalic(false); + SetFontSize(27); + glColor4f(1, 1, 1, 1); + for S := 0 to high(CTime_hold) do + begin + visibleText := inttostr(CTime_hold[S]); + SetFontPos (500, X); + glPrint(visibleText[0]); + X := X + 20; + end; +} end; procedure Start3D; @@ -344,10 +345,11 @@ begin glMatrixMode(GL_PROJECTION); glPushMatrix; glLoadIdentity; - glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + 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); @@ -367,7 +369,7 @@ var myAngle: real; const myLogoCoords: array[0..27,0..1] of cardinal = ( - (39,32),(84,32),(100,16),(125,24), + ( 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), @@ -376,10 +378,10 @@ const (450,32),(485,34),(444,91),(486,93) ); begin - //dis does teh muiwk y0r + // dis does teh muiwk y0r to be translated :-) AudioPlayback.GetFFTData(Data); - Log.LogStatus('',' JB-1'); + Log.LogStatus('', ' JB-1'); T := SDL_GetTicks() div 33; if T <> Credits_Time then @@ -389,11 +391,11 @@ begin inc(CTime_hold); Credits_X := Credits_X-2; - Log.LogStatus('',' JB-2'); + Log.LogStatus('', ' JB-2'); if (CRDTS_Stage=InitialDelay) and (CTime = Timings[0]) then begin - //CTime := Timings[20]; - //CRDTS_Stage := Outro; +// CTime := Timings[20]; +// CRDTS_Stage := Outro; CRDTS_Stage := Intro; CTime := 0; AudioPlayback.Play; @@ -404,16 +406,16 @@ begin end; if (CRDTS_Stage = MainPart) and (CTime = Timings[20]) then begin - CRDTS_Stage:=Outro; + CRDTS_Stage := Outro; end; end; - Log.LogStatus('',' JB-3'); + Log.LogStatus('', ' JB-3'); - //draw background + // draw background if CRDTS_Stage = InitialDelay then begin - glClearColor(0,0,0,0); + glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); end else @@ -422,7 +424,7 @@ begin Start3D; glPushMatrix; - glClearColor(0,0,0,0); + glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glEnable(GL_TEXTURE_2D); @@ -431,8 +433,8 @@ begin 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 + 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 @@ -441,87 +443,87 @@ begin 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; + 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 + glTranslatef(0, 0, -5 + 0.5 * myScale); if CTime > Timings[3] then - myScale:=1; // keep the space between layers + 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); +// 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); + 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); @@ -532,10 +534,10 @@ begin // do some sparkling effects if (CTime < Timings[1]) and (CTime > Timings[21]) then begin - for k:=1 to 3 do + 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); + 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; @@ -543,13 +545,13 @@ begin // 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])); + 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); + glVertex2f( 0, 0); + glVertex2f( 0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); glEnd; glDisable(GL_BLEND); end; @@ -566,10 +568,10 @@ begin 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); + 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); @@ -580,14 +582,14 @@ begin //######################################################################### // draw credits names - Log.LogStatus('',' JB-4'); + Log.LogStatus('', ' JB-4'); // BlindGuard (rotate in from upper left, rotate out to lower right) - STime := Timings[9]-10; - Delay := Timings[10]-Timings[9]; + STime := Timings[9] - 10; + Delay := Timings[10] - Timings[9]; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -620,7 +622,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -636,26 +638,26 @@ begin end; glPushMatrix; - gltranslatef(0,329,0); + gltranslatef(0, 329, 0); if CTime <= STime + 10 then - glrotatef((CTime - STime) * 9 + 270,0,0,1); - gltranslatef(223,0,0); + glrotatef((CTime - STime) * 9 + 270, 0, 0, 1); + 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); + 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); + 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); @@ -700,7 +702,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime+20) and (CTime<=STime+22) then begin @@ -716,31 +718,31 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + 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); + 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); + 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); + 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); @@ -748,11 +750,11 @@ begin end; // Canni (shift in from left, shift out to upper right) - STime := Timings[11]-10; - Delay := Timings[12]-Timings[11]+5; + STime := Timings[11] - 10; + Delay := Timings[12] - Timings[11] + 5; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -785,7 +787,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -801,25 +803,26 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + 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); + 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); + 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); @@ -827,11 +830,11 @@ begin end; // Commandio (flip in from down, flip out to upper right) - STime := Timings[12]-10; - Delay := Timings[13]-Timings[12]; + STime := Timings[12] - 10; + Delay := Timings[13] - Timings[12]; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -864,7 +867,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -880,9 +883,9 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + gltranslatef(223, 329, 0); if CTime <= STime + 10 then - f:=258.0-25.8*(CTime-STime) + f := 258.0 - 25.8 * (CTime - STime) else f := 0; g := 0; @@ -897,10 +900,10 @@ begin 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); + 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); @@ -908,11 +911,11 @@ begin 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; + STime := Timings[13] - 35; + Delay := Timings[14] - Timings[13] + 5; if CTime > STime then begin - k:=0; + k := 0; try for j := 0 to 40 do @@ -933,32 +936,32 @@ begin inc(ESC_Alpha); if ESC_Alpha > 20 then ESC_Alpha := 20; - if ((CTime-STime)>10) and ((CTime - STime) < 20) then + if ((CTime - STime) > 10) and ((CTime - STime) < 20) then ESC_Alpha := 20; - ESC_Alpha:=10; - f:=CTime-STime; - if CTime <=STime+40 then + ESC_Alpha := 10; + f := CTime - STime; + if CTime <= STime + 40 then j := CTime - STime else - j:=40; - if (CTime >=STime+Delay-40) then + 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); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j * j / 1600); glPushMatrix; - gltranslatef(180+(f-70),329,0); + 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); + 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); @@ -966,11 +969,11 @@ begin end; // Mog (flip in from right, flip out to lower right) - STime := Timings[14]-10; - Delay := Timings[15]-Timings[14]+5; + STime := Timings[14] - 10; + Delay := Timings[15] - Timings[14] + 5; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -1003,7 +1006,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -1019,27 +1022,28 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + 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; + 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); + 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); @@ -1047,11 +1051,11 @@ begin end; // Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing) - STime := Timings[15]-10; - Delay := Timings[16]-Timings[15]+5; + STime := Timings[15] - 10; + Delay := Timings[16] - Timings[15] + 5; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -1084,7 +1088,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -1100,31 +1104,31 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + 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); + 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); + 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); + 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); @@ -1132,11 +1136,11 @@ begin end; // Skillmaster (shift in from lower right, rotate out to upper right) - STime := Timings[16]-10; - Delay := Timings[17]-Timings[16]+5; + STime := Timings[16] - 10; + Delay := Timings[17] - Timings[16] + 5; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -1169,7 +1173,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -1185,31 +1189,31 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + gltranslatef(223, 329, 0); if CTime <= STime + 10 then begin j := STime + 10 - CTime; f := j * 10.0; - gltranslatef(+f*2,+f/2,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); + 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); + 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); @@ -1221,7 +1225,7 @@ begin Delay := Timings[18] - Timings[17]; if CTime > STime then begin - k:=0; + k := 0; ESC_Alpha := 20; try @@ -1254,7 +1258,7 @@ begin j := (STime + Delay) - CTime else j := 0; - glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); if (CTime >= STime + 10) and (CTime <= STime + 12) then begin @@ -1270,7 +1274,7 @@ begin end; glPushMatrix; - gltranslatef(223,329,0); + gltranslatef(223, 329, 0); if CTime <= STime + 10 then f := 326.0 - 32.6 * (CTime - STime) else @@ -1291,17 +1295,17 @@ begin 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); + glTexCoord2f(0, 0); glVertex2f(-163 - f + g, -129 + f / 4 - g / 2); + glTexCoord2f(0, 1); glVertex2f(-163 - f / 4 + g, 129 + g / 2 + f / 4); + glTexCoord2f(1, 1); glVertex2f( 163 - f * 1.2 + g / 4, 129 + f / 2 - g / 4); + glTexCoord2f(1, 0); glVertex2f( 163 - f * 1.5 + g / 4, -129 + f * 1.5 + g / 4); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); glPopMatrix; end; - Log.LogStatus('',' JB-103'); + Log.LogStatus('', ' JB-103'); // #################################################################### // do some twinkle stuff (kinda on beat) @@ -1326,15 +1330,15 @@ begin if Data[k] > 0.2 then begin - l := RandomRange(6,16); - j := RandomRange(0,27); + 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 + // draw the rest of the main screen (girl and logo) glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1342,21 +1346,21 @@ begin 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); + 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); + 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); @@ -1364,13 +1368,13 @@ begin // fade out at end of main part if Ctime > Timings[19] then begin - glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); + 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); + glVertex2f( 0, 0); + glVertex2f( 0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); glEnd; glDisable(GL_BLEND); end; @@ -1392,7 +1396,7 @@ begin AudioPlayback.Play; Ctime_hold := 0; end; - glClearColor(0,0,0,0); + glClearColor(0, 0, 0, 0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); // do something useful @@ -1404,20 +1408,20 @@ begin 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); + 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); + // 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); + 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; @@ -1427,13 +1431,13 @@ begin inc(ESC_Alpha); if ESC_Alpha > 20 then ESC_Alpha := 20; - glColor4f(1, 1, 1, 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); + 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); @@ -1442,17 +1446,17 @@ begin // ... end; - { +{ // draw credits runtime counter - SetFontStyle (2); + SetFontStyle (2); SetFontItalic(false); SetFontSize(27); 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(floor(CTime / 30.320663991914489602156136106092)) + '.' + inttostr(floor(CTime / 3.0320663991914489602156136106092) - floor(CTime / 30.320663991914489602156136106092) * 10); RuntimeStr := 'CTime: ' + inttostr(CTime); glPrint (RuntimeStr[1]); - } +} // make the stars shine GoldenRec.Draw; -- cgit v1.2.3 From 7cf14a865954a7208f76421a396ea33c3cc87ab9 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 25 Apr 2009 18:18:53 +0000 Subject: correcting typos from cosmetics git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1699 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 1d0e5466..def6b7de 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -108,8 +108,8 @@ type const Funky_Text: string = - '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 '+ + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you are hearing, '+ + 'all the people who put massive effort and work in new songs (do not 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,..'; -- cgit v1.2.3 From 4f8afae1ce76884c54d4b2de9de2186e29115c57 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sat, 16 May 2009 22:04:15 +0000 Subject: add lyric-bar bounds to theme thx to Krueger git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1746 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index c29c0e2c..4389352a 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -297,8 +297,8 @@ begin Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( - Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, - Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); + Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, + Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); LyricsSync := TLyricsSyncSource.Create(); end; -- cgit v1.2.3 From 69d651dd5933520713ac0ecb4875f0e6702ba002 Mon Sep 17 00:00:00 2001 From: mogguh Date: Tue, 26 May 2009 23:01:19 +0000 Subject: Statics defined in theme don't necessarily need a width or height set, if omitted the the values from the texture itself will be used SelectSlides may now have arrows and only one item set, default is off - view UScreenOptionsGame.pas as example on how to set this git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1783 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGame.pas | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 3c78363f..3f1cca81 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -126,13 +126,32 @@ begin old_Sorting := Ini.Sorting; old_Tabs := Ini.Tabs; + Theme.OptionsGame.SelectPlayers.showArrows := true; + Theme.OptionsGame.SelectPlayers.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); + + Theme.OptionsGame.SelectDifficulty.showArrows := true; + Theme.OptionsGame.SelectDifficulty.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + + Theme.OptionsGame.SelectLanguage.showArrows := true; + Theme.OptionsGame.SelectLanguage.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + + Theme.OptionsGame.SelectTabs.showArrows := true; + Theme.OptionsGame.SelectTabs.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + + Theme.OptionsGame.SelectSorting.showArrows := true; + Theme.OptionsGame.SelectSorting.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + + Theme.OptionsGame.SelectDebug.showArrows := true; + Theme.OptionsGame.SelectDebug.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + + AddButton(Theme.OptionsGame.ButtonExit); if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); -- cgit v1.2.3 From bee4da886058f54ec7e1901951b5c1bf05f8ea34 Mon Sep 17 00:00:00 2001 From: mogguh Date: Wed, 27 May 2009 22:09:26 +0000 Subject: All options do have one option visible now FIXED: SelectSlides with only two options did not show arrows on reelection ENHANCEMENT: Beautified some portions of UMenuSelectSlide.pas code git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1784 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsAdvanced.pas | 17 +++++++++++++++ src/screens/UScreenOptionsGraphics.pas | 17 +++++++++++++++ src/screens/UScreenOptionsLyrics.pas | 9 +++++++- src/screens/UScreenOptionsRecord.pas | 5 +++++ src/screens/UScreenOptionsSound.pas | 40 +++++++++++++++++++++++++--------- src/screens/UScreenOptionsThemes.pas | 6 +++++ 6 files changed, 83 insertions(+), 11 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index f57ee865..d5f58c72 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -129,11 +129,28 @@ begin //SelectLoadAnimation Hidden because it is useless atm //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + Theme.OptionsAdvanced.SelectScreenFade.showArrows := true; + Theme.OptionsAdvanced.SelectScreenFade.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + + Theme.OptionsAdvanced.SelectEffectSing.showArrows := true; + Theme.OptionsAdvanced.SelectEffectSing.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); + + Theme.OptionsAdvanced.SelectLineBonus.showArrows := true; + Theme.OptionsAdvanced.SelectLineBonus.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + + Theme.OptionsAdvanced.SelectOnSongClick.showArrows := true; + Theme.OptionsAdvanced.SelectOnSongClick.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + + Theme.OptionsAdvanced.SelectAskbeforeDel.showArrows := true; + Theme.OptionsAdvanced.SelectAskbeforeDel.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel); + + Theme.OptionsAdvanced.SelectPartyPopup.showArrows := true; + Theme.OptionsAdvanced.SelectPartyPopup.oneItemOnly := true; AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); AddButton(Theme.OptionsAdvanced.ButtonExit); diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 896f3d99..1ac2a9c4 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -132,11 +132,28 @@ begin inherited Create; LoadFromTheme(Theme.OptionsGraphics); + Theme.OptionsGraphics.SelectResolution.showArrows := true; + Theme.OptionsGraphics.SelectResolution.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); + + Theme.OptionsGraphics.SelectFullscreen.showArrows := true; + Theme.OptionsGraphics.SelectFullscreen.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + + Theme.OptionsGraphics.SelectDepth.showArrows := true; + Theme.OptionsGraphics.SelectDepth.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + + Theme.OptionsGraphics.SelectVisualizer.showArrows := true; + Theme.OptionsGraphics.SelectVisualizer.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); + + Theme.OptionsGraphics.SelectOscilloscope.showArrows := true; + Theme.OptionsGraphics.SelectOscilloscope.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + + Theme.OptionsGraphics.SelectMovieSize.showArrows := true; + Theme.OptionsGraphics.SelectMovieSize.oneItemOnly := true; AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); AddButton(Theme.OptionsGraphics.ButtonExit); diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 7efe1cd2..dbc57cb3 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -119,9 +119,16 @@ begin LoadFromTheme(Theme.OptionsLyrics); + Theme.OptionsLyrics.SelectLyricsFont.showArrows := true; + Theme.OptionsLyrics.SelectLyricsFont.oneItemOnly := true; AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + + Theme.OptionsLyrics.SelectLyricsEffect.showArrows := true; + Theme.OptionsLyrics.SelectLyricsEffect.oneItemOnly := true; AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); - //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!! + + Theme.OptionsLyrics.SelectNoteLines.showArrows := true; + Theme.OptionsLyrics.SelectNoteLines.oneItemOnly := true; AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); AddButton(Theme.OptionsLyrics.ButtonExit); diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 3737a134..cf799204 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -244,6 +244,8 @@ begin InputDeviceNames[DeviceIndex] := AudioInputProcessor.DeviceList[DeviceIndex].Name; end; // add device-selection slider (InteractionID: 0) + Theme.OptionsRecord.SelectSlideCard.showArrows := true; + Theme.OptionsRecord.SelectSlideCard.oneItemOnly := true; AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, CurrentDeviceIndex, InputDeviceNames); // init source-selection slider @@ -252,6 +254,9 @@ begin begin InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name; end; + + Theme.OptionsRecord.SelectSlideInput.showArrows := true; + Theme.OptionsRecord.SelectSlideInput.oneItemOnly := true; // add source-selection slider (InteractionID: 1) SelectInputSourceID := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, InputDeviceCfg.Input, InputSourceNames); diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 99ecb599..f10c1cb9 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -136,19 +136,39 @@ begin LoadFromTheme(Theme.OptionsSound); - AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, - Ini.VoicePassthrough, IVoicePassthrough); - AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, - Ini.BackgroundMusicOption, IBackgroundMusic); - AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + Theme.OptionsSound.SelectSlideVoicePassthrough.showArrows := true; + Theme.OptionsSound.SelectSlideVoicePassthrough.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthrough); + + Theme.OptionsSound.SelectBackgroundMusic.showArrows := true; + Theme.OptionsSound.SelectBackgroundMusic.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusic); + // TODO: - MicBoost needs to be moved to ScreenOptionsRecord + Theme.OptionsSound.SelectMicBoost.showArrows := true; + Theme.OptionsSound.SelectMicBoost.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + + + Theme.OptionsSound.SelectClickAssist.showArrows := true; + Theme.OptionsSound.SelectClickAssist.oneItemOnly := true; AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); - AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + + Theme.OptionsSound.SelectThreshold.showArrows := true; + Theme.OptionsSound.SelectThreshold.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.BeatClick, IBeatClick); + + Theme.OptionsSound.SelectThreshold.showArrows := true; + Theme.OptionsSound.SelectThreshold.oneItemOnly := true; AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.ThresholdIndex, IThreshold); - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, - Ini.PreviewVolume, IPreviewVolume); - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, - Ini.PreviewFading, IPreviewFading); + + Theme.OptionsSound.SelectSlidePreviewVolume.showArrows := true; + Theme.OptionsSound.SelectSlidePreviewVolume.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); + + Theme.OptionsSound.SelectSlidePreviewFading.showArrows := true; + Theme.OptionsSound.SelectSlidePreviewFading.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index e44bfca8..beb23023 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -161,10 +161,16 @@ begin LoadFromTheme(Theme.OptionsThemes); + Theme.OptionsThemes.SelectTheme.showArrows := true; + Theme.OptionsThemes.SelectTheme.oneItemOnly := true; AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); + Theme.OptionsThemes.SelectSkin.showArrows := true; + Theme.OptionsThemes.SelectSkin.oneItemOnly := true; SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); + Theme.OptionsThemes.SelectColor.showArrows := true; + Theme.OptionsThemes.SelectColor.oneItemOnly := true; AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); AddButton(Theme.OptionsThemes.ButtonExit); -- cgit v1.2.3 From 83fbcd53cb2ffb4fa930df1234e4388ca9fdf07f Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 28 May 2009 17:30:21 +0000 Subject: change range of random. was probably reason for out of range crash. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1786 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 95 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 48 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 8f4dd5da..f937b1dc 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -175,7 +175,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + for I := Low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -196,7 +196,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := low(CatSongs.Song) to High(Catsongs.Song) do + for I := Low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -280,7 +280,7 @@ begin //Jump To Titel if (SDL_ModState = (KMOD_LALT or KMOD_LSHIFT)) then begin - for I := 1 to high(CatSongs.Song) do + 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 @@ -300,7 +300,7 @@ begin //Jump to Artist else if (SDL_ModState = KMOD_LALT) then begin - for I := 1 to high(CatSongs.Song) do + 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 @@ -395,25 +395,25 @@ begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then //Random Category + if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then // random category begin - I2 := 0; //Count Cats - for I:= 0 to high(CatSongs.Song) do + I2 := 0; // count cats + for I := 0 to High(CatSongs.Song) do begin if CatSongs.Song[I].Main then Inc(I2); end; - I2 := Random(I2)+1; //Zufall + I2 := Random(I2 + 1); // random and include I2 - //Find Cat: - for I:= 0 to high(CatSongs.Song) do + // find cat: + for I := 0 to High(CatSongs.Song) do begin if CatSongs.Song[I].Main then Dec(I2); - if (I2<=0) then + if (I2 <= 0) then begin - //Show Cat in Top Left Mod + // show cat in top left mod ShowCatTL (I); Interaction := I; @@ -426,38 +426,38 @@ begin end; end; end - else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then //random in All Categorys + else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then // random in all categories begin repeat - I2 := Random(high(CatSongs.Song)+1) + 1; + I2 := Random(High(CatSongs.Song) + 1); until (not CatSongs.Song[I2].Main); - //Search Cat + // search cat for I := I2 downto 0 do begin if CatSongs.Song[I].Main then break; end; - //In I is now the categorie in I2 the song + // in I is now the categorie in I2 the song - //Choose Cat + // choose cat CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod + // show cat in top left mod ShowCatTL (I); CatSongs.ClickCategoryButton(I); SelectNext; - //Fix: Not Existing Song selected: - //if (I+1=I2) then + // Fix: not existing song selected: + //if (I + 1 = I2) then Inc(I2); - //Choose Song - SkipTo(I2-I); + // choose song + SkipTo(I2 - I); end - else //Random in one Category + else // random in one category begin SkipTo(Random(CatSongs.VisibleSongs)); end; @@ -489,7 +489,7 @@ begin break; end; if (I <= 1) then - Interaction := high(CatSongs.Song) + Interaction := High(CatSongs.Song) else Interaction := I - 1; @@ -611,8 +611,8 @@ begin while not catsongs.Song[I].Main do begin Inc (I); - if (I > high(catsongs.Song)) then - I := low(catsongs.Song); + if (I > High(catsongs.Song)) then + I := Low(catsongs.Song); end; Interaction := I; @@ -655,8 +655,8 @@ begin if catsongs.Song[I].Main then Inc(I2); Dec (I); - if (I < low(catsongs.Song)) then - I := high(catsongs.Song); + if (I < Low(catsongs.Song)) then + I := High(catsongs.Song); end; Interaction := I; @@ -1312,7 +1312,7 @@ begin else begin //Change Pos of all Buttons - for B := low(Button) to high(Button) do + 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 @@ -1701,41 +1701,40 @@ var I, I2: integer; begin case PlaylistMan.Mode of - smNormal: //All Songs Just Select Random Song + smNormal: // all songs just select random song begin - //When Tabs are activated then use Tab Method + // when tabs are activated then use tab method if (Ini.TabsAtStartup = 1) then begin repeat - I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; + I2 := Low(CatSongs.Song) + Random(High(CatSongs.Song) + 1 - Low(CatSongs.Song)); until CatSongs.Song[I2].Main = false; - //Search Cat - for I := I2 downto low(CatSongs.Song) do + // 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 + // I is the cat number, I2 is the no of the song within this cat - //Choose Cat + // choose cat CatSongs.ShowCategoryList; - //Show Cat in Top Left Mod - ShowCatTL (I); + // show cat in top left mod + ShowCatTL(I); CatSongs.ClickCategoryButton(I); SelectNext; - //Choose Song - SkipTo(I2-I); + // choose song + SkipTo(I2 - I); end - //When Tabs are deactivated use easy Method + // when tabs are deactivated use easy method else SkipTo(Random(CatSongs.VisibleSongs)); end; - smPartyMode: //One Category Select Category and Select Random Song + smPartyMode: // one category select category and select random song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1746,7 +1745,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - smPlaylistRandom: //Playlist: Select Playlist and Select Random Song + smPlaylistRandom: // playlist: select playlist and select random song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1846,19 +1845,19 @@ begin //Set Visibility of Party Statics and Text Visible := (Mode = smPartyMode); - for I := 0 to high(StaticParty) do + for I := 0 to High(StaticParty) do Static[StaticParty[I]].Visible := Visible; - for I := 0 to high(TextParty) do + 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 + for I := 0 to High(StaticNonParty) do Static[StaticNonParty[I]].Visible := Visible; - for I := 0 to high(TextNonParty) do + for I := 0 to High(TextNonParty) do Text[TextNonParty[I]].Visible := Visible; end; -- cgit v1.2.3 From 257854c587f0876a912cfbeb4fe0a30970d25a9b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 31 May 2009 14:10:42 +0000 Subject: merged (experimental) mouse support patch by d0ccrazy some changes to patch - implemented software cursor (texturable) - option to turn of mouse support or switch between hardware and software cursor - hide software cursor if there is no mouse activity for 5 seconds - soft fade in and out for software cursor - some test cursor-textures for deluxe theme (mog pls change these horible looking images) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1789 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 34 +++++++--------------------------- src/screens/UScreenScore.pas | 10 ++++++++++ src/screens/UScreenSing.pas | 10 +++++++++- src/screens/UScreenSong.pas | 23 +++++++++++++++++++++++ src/screens/UScreenTop5.pas | 10 ++++++++++ 5 files changed, 59 insertions(+), 28 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 36cf84b0..a4e6009f 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -52,10 +52,7 @@ type function ParseInput(PressedKey: cardinal; CharCode: widechar; PressedDown: boolean): boolean; override; procedure onShow; override; - procedure InteractNext; override; - procedure InteractPrev; override; - procedure InteractInc; override; - procedure InteractDec; override; + procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; end; @@ -238,36 +235,19 @@ end; procedure TScreenMain.onShow; begin inherited; + + { display cursor (on moved) } + Display.SetCursor; + {** * Start background music *} SoundLib.StartBgMusic; end; -procedure TScreenMain.InteractNext; -begin - inherited InteractNext; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractPrev; -begin - inherited InteractPrev; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractDec; -begin - inherited InteractDec; - Text[TextDescription].Text := Theme.Main.Description[Interaction]; - Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; -end; - -procedure TScreenMain.InteractInc; +procedure TScreenMain.SetInteraction(Num: integer); begin - inherited InteractInc; + inherited SetInteraction(Num); Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; end; diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index f3f888b3..a01c7691 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -129,6 +129,7 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; procedure onShow; override; procedure onShowFinish; override; function Draw: boolean; override; @@ -191,6 +192,15 @@ begin end; end; +function TScreenScore.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +begin + Result := True; + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + //left-click anywhere sends return + ParseInput(SDLK_RETURN, #0, true); + end; +end; + constructor TScreenScore.Create; var Player: integer; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 4389352a..ae75c74d 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -126,7 +126,8 @@ uses ULanguage, UNote, URecord, - USong; + USong, + UDisplay; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; @@ -253,6 +254,9 @@ constructor TScreenSing.Create; begin inherited Create; + //too dangerous, a mouse button is quickly pressed by accident + RightMbESC := false; + fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -623,6 +627,9 @@ end; procedure TScreenSing.onShowFinish; begin + // hide cursor on singscreen show + Display.SetCursor; + // start lyrics LyricsState.Resume(); @@ -643,6 +650,7 @@ begin end; Background.OnFinish; + Display.SetCursor; end; function TScreenSing.Draw: boolean; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index f937b1dc..5e794891 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -119,6 +119,7 @@ type procedure SetScroll5; procedure SetScroll6; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); procedure onShow; override; @@ -737,6 +738,28 @@ begin end; // if (PressedDown) end; +function TScreenSong.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +begin + Result := True; + + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then begin + //if RightMbESC is set, send ESC keypress + Result:=ParseInput(SDLK_ESCAPE, #0, True); + end; + + //song scrolling with mousewheel + if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then begin + ParseInput(SDLK_RIGHT, #0, true); + end; + if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then begin + ParseInput(SDLK_LEFT, #0, true); + end; + //LMB anywhere starts + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + ParseInput(SDLK_RETURN, #0, true); + end; +end; + constructor TScreenSong.Create; var i: integer; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 23405ebb..39de61c3 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -57,6 +57,7 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; procedure onShow; override; function Draw: boolean; override; end; @@ -103,6 +104,15 @@ begin end; end; +function TScreenTop5.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +begin + Result := True; + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + //left-click anywhere sends return + ParseInput(SDLK_RETURN, #0, true); + end; +end; + constructor TScreenTop5.Create; var I: integer; -- cgit v1.2.3 From 6f3d675698f54c5cace969befaeaa6f38ca001ad Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 1 Jun 2009 09:30:11 +0000 Subject: fix display of beatclick select in ScreenOptionSound git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1793 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsSound.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index f10c1cb9..78b09c97 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -154,9 +154,9 @@ begin Theme.OptionsSound.SelectClickAssist.oneItemOnly := true; AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); - Theme.OptionsSound.SelectThreshold.showArrows := true; - Theme.OptionsSound.SelectThreshold.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.BeatClick, IBeatClick); + Theme.OptionsSound.SelectBeatClick.showArrows := true; + Theme.OptionsSound.SelectBeatClick.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); Theme.OptionsSound.SelectThreshold.showArrows := true; Theme.OptionsSound.SelectThreshold.oneItemOnly := true; -- cgit v1.2.3 From a4d1d415d9dda4aada1126a2b520a3588e446d12 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 1 Jun 2009 20:50:52 +0000 Subject: fix a mac crash and possibly others. division by zero git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1797 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditConvert.pas | 43 ++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index 361a3be7..e4a691cf 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -34,6 +34,7 @@ interface {$I switches.inc} uses + math, UMenu, SDL, {$IFDEF UseMIDIPort} @@ -575,7 +576,7 @@ var Bottom: real; X: real; Y: real; - H: real; + Height: real; YSkip: real; begin // draw static menu @@ -583,20 +584,24 @@ begin Y := 100; - H := Length(ATrack)*40; - if H > 480 then - H := 480; - Bottom := Y + H; + Height := min(480, 40 * Length(ATrack)); + Bottom := Y + Height; - YSkip := H / Length(ATrack); + if Length(ATrack) = 0 then // prevent crash with uncomplete code. + begin + Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0'); + YSkip := 40; + end + else + YSkip := Height / Length(ATrack); // select - DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); // selected - now me use Status System for Count := 0 to High(ATrack) do if ATrack[Count].Hear then - DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -614,12 +619,12 @@ begin end; end; - DrawLine(10, Y, 10, Bottom, 0, 0, 0); - DrawLine(60, Y, 60, Bottom, 0, 0, 0); + DrawLine( 10, Y, 10, Bottom, 0, 0, 0); + DrawLine( 60, Y, 60, Bottom, 0, 0, 0); DrawLine(790, Y, 790, Bottom, 0, 0, 0); for Count := 0 to Length(ATrack) do - DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0); + DrawLine(10, Y + Count*YSkip, 790, Y + Count*YSkip, 0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -632,9 +637,21 @@ begin for Count2 := 0 to High(ATrack[Count].Note) do begin if ATrack[Count].Note[Count2].EventType = 9 then - DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]); + DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, + 3, + 3, + ColR[Count], + ColG[Count], + ColB[Count]); if ATrack[Count].Note[Count2].EventType = 15 then - DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]); + DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + 0.75*YSkip + Count*YSkip, + 60 + ATrack[Count].Note[Count2].Start/Len*725, + Y + YSkip + Count*YSkip, + ColR[Count], + ColG[Count], + ColB[Count]); end; // playing line -- cgit v1.2.3 From 133f0b4ebcc3b731e680a72ced52d00638791bf7 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 4 Jun 2009 21:31:23 +0000 Subject: cosmetics git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1800 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGame.pas | 35 +++++++++++++++-------------- src/screens/UScreenSong.pas | 46 ++++++++++++++++++-------------------- src/screens/UScreenTop5.pas | 35 +++++++++++++++-------------- 3 files changed, 58 insertions(+), 58 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 3f1cca81..00ff372d 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -34,14 +34,14 @@ interface {$I switches.inc} uses - UMenu, SDL, UDisplay, - UMusic, UFiles, UIni, - UThemes, - USongs; + UMenu, + UMusic, + USongs, + UThemes; type TScreenOptionsGame = class(TMenu) @@ -56,13 +56,15 @@ type implementation uses - UGraphic, - SysUtils; + SysUtils, + UGraphic; -function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsGame.ParseInput(PressedKey: cardinal; + CharCode: WideChar; + PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then + if PressedDown then begin // Key Down // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -80,7 +82,6 @@ begin begin AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; - FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -126,34 +127,34 @@ begin old_Sorting := Ini.Sorting; old_Tabs := Ini.Tabs; - Theme.OptionsGame.SelectPlayers.showArrows := true; + Theme.OptionsGame.SelectPlayers.showArrows := true; Theme.OptionsGame.SelectPlayers.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); - Theme.OptionsGame.SelectDifficulty.showArrows := true; + Theme.OptionsGame.SelectDifficulty.showArrows := true; Theme.OptionsGame.SelectDifficulty.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); - Theme.OptionsGame.SelectLanguage.showArrows := true; + Theme.OptionsGame.SelectLanguage.showArrows := true; Theme.OptionsGame.SelectLanguage.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); - Theme.OptionsGame.SelectTabs.showArrows := true; + Theme.OptionsGame.SelectTabs.showArrows := true; Theme.OptionsGame.SelectTabs.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); - Theme.OptionsGame.SelectSorting.showArrows := true; + Theme.OptionsGame.SelectSorting.showArrows := true; Theme.OptionsGame.SelectSorting.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); - Theme.OptionsGame.SelectDebug.showArrows := true; + Theme.OptionsGame.SelectDebug.showArrows := true; Theme.OptionsGame.SelectDebug.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); AddButton(Theme.OptionsGame.ButtonExit); - if (Length(Button[0].Text)=0) then + if (Length(Button[0].Text) = 0) then AddButtonText(14, 20, Theme.Options.Description[7]); end; @@ -161,7 +162,7 @@ end; //Refresh Songs Patch procedure TScreenOptionsGame.RefreshSongs; begin -if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then ScreenSong.Refresh; end; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 5e794891..fa3c836e 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -34,22 +34,22 @@ interface {$I switches.inc} uses - UMenu, - SDL, - UMusic, - UFiles, - UTime, - UDisplay, - USongs, SysUtils, + SDL, UCommon, - ULog, - UThemes, - UTexture, + UDisplay, + UFiles, + UIni, ULanguage, + ULog, + UMenu, + UMenuEqualizer, + UMusic, USong, - UIni, - UMenuEqualizer; + USongs, + UTexture, + UThemes, + UTime; type TScreenSong = class(TMenu) @@ -119,7 +119,7 @@ type procedure SetScroll5; procedure SetScroll6; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); procedure onShow; override; @@ -738,26 +738,24 @@ begin end; // if (PressedDown) end; -function TScreenSong.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; begin - Result := True; + Result := true; - if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then begin + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, #0, True); - end; + Result:=ParseInput(SDLK_ESCAPE, #0, true); //song scrolling with mousewheel - if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then begin + if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then ParseInput(SDLK_RIGHT, #0, true); - end; - if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then begin + + if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then ParseInput(SDLK_LEFT, #0, true); - end; + //LMB anywhere starts - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then ParseInput(SDLK_RETURN, #0, true); - end; end; constructor TScreenSong.Create; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 39de61c3..1013a9b5 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -57,7 +57,7 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure onShow; override; function Draw: boolean; override; end; @@ -70,10 +70,12 @@ uses UIni, UNote; -function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenTop5.ParseInput(PressedKey: cardinal; + CharCode: WideChar; + PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then + if PressedDown then begin // check normal keys case WideCharUpperCase(CharCode)[1] of @@ -104,13 +106,14 @@ begin end; end; -function TScreenTop5.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; +function TScreenTop5.ParseMouse(MouseButton: integer; + BtnDown: boolean; + X, Y: integer): boolean; begin - Result := True; - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin + Result := true; + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then //left-click anywhere sends return ParseInput(SDLK_RETURN, #0, true); - end; end; constructor TScreenTop5.Create; @@ -121,18 +124,16 @@ begin LoadFromTheme(Theme.Top5); - TextLevel := AddText(Theme.Top5.TextLevel); + TextLevel := AddText(Theme.Top5.TextLevel); TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); for I := 0 to 4 do - StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); - - for I := 0 to 4 do - TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); - for I := 0 to 4 do - TextName[I+1] := AddText(Theme.Top5.TextName[I]); - for I := 0 to 4 do - TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); + begin + StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); + TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]); + TextName[I+1] := AddText (Theme.Top5.TextName[I]); + TextScore[I+1] := AddText (Theme.Top5.TextScore[I]); + end; end; @@ -169,7 +170,7 @@ begin Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do + for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; -- cgit v1.2.3 From 036ad16426b7003cf872ce49d8854648217eba8b Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sat, 27 Jun 2009 20:01:11 +0000 Subject: Translation of option values. part 2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1829 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsAdvanced.pas | 14 +++++++------- src/screens/UScreenOptionsGame.pas | 8 ++++---- src/screens/UScreenOptionsGraphics.pas | 8 ++++---- src/screens/UScreenOptionsLyrics.pas | 6 +++--- src/screens/UScreenOptionsSound.pas | 14 +++++++------- src/screens/UScreenOptionsThemes.pas | 2 +- 6 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index d5f58c72..0fb8153c 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -128,30 +128,30 @@ begin LoadFromTheme(Theme.OptionsAdvanced); //SelectLoadAnimation Hidden because it is useless atm - //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimationTranslated); Theme.OptionsAdvanced.SelectScreenFade.showArrows := true; Theme.OptionsAdvanced.SelectScreenFade.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFadeTranslated); Theme.OptionsAdvanced.SelectEffectSing.showArrows := true; Theme.OptionsAdvanced.SelectEffectSing.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); + AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSingTranslated); Theme.OptionsAdvanced.SelectLineBonus.showArrows := true; Theme.OptionsAdvanced.SelectLineBonus.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonusTranslated); Theme.OptionsAdvanced.SelectOnSongClick.showArrows := true; Theme.OptionsAdvanced.SelectOnSongClick.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClickTranslated); Theme.OptionsAdvanced.SelectAskbeforeDel.showArrows := true; Theme.OptionsAdvanced.SelectAskbeforeDel.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel); + AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDelTranslated); Theme.OptionsAdvanced.SelectPartyPopup.showArrows := true; Theme.OptionsAdvanced.SelectPartyPopup.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); + AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopupTranslated); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 00ff372d..1d741d25 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -133,7 +133,7 @@ begin Theme.OptionsGame.SelectDifficulty.showArrows := true; Theme.OptionsGame.SelectDifficulty.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); + AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficultyTranslated); Theme.OptionsGame.SelectLanguage.showArrows := true; Theme.OptionsGame.SelectLanguage.oneItemOnly := true; @@ -141,15 +141,15 @@ begin Theme.OptionsGame.SelectTabs.showArrows := true; Theme.OptionsGame.SelectTabs.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabsTranslated); Theme.OptionsGame.SelectSorting.showArrows := true; Theme.OptionsGame.SelectSorting.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISortingTranslated); Theme.OptionsGame.SelectDebug.showArrows := true; Theme.OptionsGame.SelectDebug.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); + AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebugTranslated); diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 1ac2a9c4..ba1465b2 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -138,7 +138,7 @@ begin Theme.OptionsGraphics.SelectFullscreen.showArrows := true; Theme.OptionsGraphics.SelectFullscreen.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullScreenTranslated); Theme.OptionsGraphics.SelectDepth.showArrows := true; Theme.OptionsGraphics.SelectDepth.oneItemOnly := true; @@ -146,15 +146,15 @@ begin Theme.OptionsGraphics.SelectVisualizer.showArrows := true; Theme.OptionsGraphics.SelectVisualizer.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizerTranslated); Theme.OptionsGraphics.SelectOscilloscope.showArrows := true; Theme.OptionsGraphics.SelectOscilloscope.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscopeTranslated); Theme.OptionsGraphics.SelectMovieSize.showArrows := true; Theme.OptionsGraphics.SelectMovieSize.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); + AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSizeTranslated); AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index dbc57cb3..035b0089 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -121,15 +121,15 @@ begin Theme.OptionsLyrics.SelectLyricsFont.showArrows := true; Theme.OptionsLyrics.SelectLyricsFont.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFontTranslated); Theme.OptionsLyrics.SelectLyricsEffect.showArrows := true; Theme.OptionsLyrics.SelectLyricsEffect.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffectTranslated); Theme.OptionsLyrics.SelectNoteLines.showArrows := true; Theme.OptionsLyrics.SelectNoteLines.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); + AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLinesTranslated); AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 78b09c97..aa87ceb4 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -138,25 +138,25 @@ begin Theme.OptionsSound.SelectSlideVoicePassthrough.showArrows := true; Theme.OptionsSound.SelectSlideVoicePassthrough.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthrough); + AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthroughTranslated); Theme.OptionsSound.SelectBackgroundMusic.showArrows := true; Theme.OptionsSound.SelectBackgroundMusic.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusic); + AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusicTranslated); // TODO: - MicBoost needs to be moved to ScreenOptionsRecord Theme.OptionsSound.SelectMicBoost.showArrows := true; Theme.OptionsSound.SelectMicBoost.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); + AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoostTranslated); Theme.OptionsSound.SelectClickAssist.showArrows := true; Theme.OptionsSound.SelectClickAssist.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); + AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssistTranslated); Theme.OptionsSound.SelectBeatClick.showArrows := true; Theme.OptionsSound.SelectBeatClick.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); + AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClickTranslated); Theme.OptionsSound.SelectThreshold.showArrows := true; Theme.OptionsSound.SelectThreshold.oneItemOnly := true; @@ -164,11 +164,11 @@ begin Theme.OptionsSound.SelectSlidePreviewVolume.showArrows := true; Theme.OptionsSound.SelectSlidePreviewVolume.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolumeTranslated); Theme.OptionsSound.SelectSlidePreviewFading.showArrows := true; Theme.OptionsSound.SelectSlidePreviewFading.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFadingTranslated); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index beb23023..1e7407f1 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -171,7 +171,7 @@ begin Theme.OptionsThemes.SelectColor.showArrows := true; Theme.OptionsThemes.SelectColor.oneItemOnly := true; - AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColorTranslated); AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then -- cgit v1.2.3 From 78f15f68ff8f7097066c28012a1af6dbab880305 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 28 Jun 2009 12:38:42 +0000 Subject: enable forgotten translation in recording settings git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1833 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsRecord.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index cf799204..7eb2ced7 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -299,7 +299,7 @@ begin // add slider SelectSlideChannelID[ChannelIndex] := AddSelectSlide(ChannelTheme^, - InputDeviceCfg.ChannelToPlayerMap[ChannelIndex], IChannelPlayer); + InputDeviceCfg.ChannelToPlayerMap[ChannelIndex], IChannelPlayerTranslated); end else begin @@ -307,7 +307,7 @@ begin // add slider but hide it and assign a dummy variable to it SelectSlideChannelID[ChannelIndex] := AddSelectSlide(ChannelTheme^, - ChannelToPlayerMapDummy, IChannelPlayer); + ChannelToPlayerMapDummy, IChannelPlayerTranslated); SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := false; end; end; @@ -373,7 +373,7 @@ begin // show slider UpdateSelectSlideOptions(SelectSlideChannelTheme[ChannelIndex], - SelectSlideChannelID[ChannelIndex], IChannelPlayer, + SelectSlideChannelID[ChannelIndex], IChannelPlayerTranslated, InputDeviceCfg.ChannelToPlayerMap[ChannelIndex]); SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := true; end @@ -383,7 +383,7 @@ begin // hide slider and assign a dummy variable to it UpdateSelectSlideOptions(SelectSlideChannelTheme[ChannelIndex], - SelectSlideChannelID[ChannelIndex], IChannelPlayer, + SelectSlideChannelID[ChannelIndex], IChannelPlayerTranslated, ChannelToPlayerMapDummy); SelectsS[SelectSlideChannelID[ChannelIndex]].Visible := false; end; -- cgit v1.2.3 From 208595ac674dfaeb586e07c8c11020298f5c6ddd Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 28 Jun 2009 12:41:20 +0000 Subject: Translation of the language settings. Part 1 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1834 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGame.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 1d741d25..0c152c41 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -137,7 +137,7 @@ begin Theme.OptionsGame.SelectLanguage.showArrows := true; Theme.OptionsGame.SelectLanguage.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); + AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguageTranslated); Theme.OptionsGame.SelectTabs.showArrows := true; Theme.OptionsGame.SelectTabs.oneItemOnly := true; -- cgit v1.2.3 From d9341fd1b98b39b641f1ab0d216cbc0daedcc67f Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 29 Jun 2009 01:43:51 +0000 Subject: fixed bug #88 fixed bug, that under some circumstances you got line bonus even with no input https://www.assembla.com/spaces/usdx/tickets/88-get-sometimes-10-points-linebonus-even-with-no-input git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1839 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index ae75c74d..9dd25cd1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -899,9 +899,9 @@ begin LineScore := CurrentScore - CurrentPlayer.ScoreLast; // determine LinePerfection - // Note: the "+2" extra points are a little bonus so the player does not + // Note: the "-2" extra points are a little bonus so the player does not // have to be that perfect to reach the bonus steps. - LinePerfection := (LineScore + 2) / MaxLineScore; + LinePerfection := LineScore / (MaxLineScore - 2); // clamp LinePerfection to range [0..1] if (LinePerfection < 0) then -- cgit v1.2.3 From 9ceadd2532207fcb512fcfecbd2895055422ad99 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Fri, 3 Jul 2009 00:02:02 +0000 Subject: fixed possible division by zero bug, if line has only 1 oder 2 points git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1845 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 9dd25cd1..9a620320 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -898,10 +898,14 @@ begin // points for this line LineScore := CurrentScore - CurrentPlayer.ScoreLast; - // determine LinePerfection - // Note: the "-2" extra points are a little bonus so the player does not - // have to be that perfect to reach the bonus steps. - LinePerfection := LineScore / (MaxLineScore - 2); + // check for lines with low points + if (MaxLineScore <= 2) then + LinePerfection := 1 + else + // determine LinePerfection + // Note: the "+2" extra points are a little bonus so the player does not + // have to be that perfect to reach the bonus steps. + LinePerfection := LineScore / (MaxLineScore - 2); // clamp LinePerfection to range [0..1] if (LinePerfection < 0) then -- cgit v1.2.3 From a77cf53f7f71a525a33c7617d74d57b4fd84e357 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 16 Aug 2009 13:17:01 +0000 Subject: some changes to prevent integer size conversions attempt to fix weird score bugs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1932 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 9a620320..157f7e64 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -859,7 +859,7 @@ end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); var - PlayerIndex: integer; + PlayerIndex: byte; CurrentPlayer: PPLayer; CurrentScore: real; Line: PLine; -- cgit v1.2.3 From 917901e8e33438c425aef50a0a7417f32d77b760 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Mon, 9 Nov 2009 00:27:55 +0000 Subject: merged unicode branch (r1931) into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1939 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 97 ++--- src/screens/UScreenEdit.pas | 11 +- src/screens/UScreenEditConvert.pas | 679 ++++++++++++++++++++------------- src/screens/UScreenEditHeader.pas | 54 +-- src/screens/UScreenEditSub.pas | 155 +++++--- src/screens/UScreenLevel.pas | 15 +- src/screens/UScreenLoading.pas | 11 +- src/screens/UScreenMain.pas | 32 +- src/screens/UScreenName.pas | 20 +- src/screens/UScreenOpen.pas | 99 ++--- src/screens/UScreenOptions.pas | 17 +- src/screens/UScreenOptionsAdvanced.pas | 15 +- src/screens/UScreenOptionsGame.pas | 27 +- src/screens/UScreenOptionsGraphics.pas | 16 +- src/screens/UScreenOptionsLyrics.pas | 13 +- src/screens/UScreenOptionsRecord.pas | 27 +- src/screens/UScreenOptionsSound.pas | 15 +- src/screens/UScreenOptionsThemes.pas | 19 +- src/screens/UScreenPartyNewRound.pas | 31 +- src/screens/UScreenPartyOptions.pas | 41 +- src/screens/UScreenPartyPlayer.pas | 22 +- src/screens/UScreenPartyScore.pas | 37 +- src/screens/UScreenPartyWin.pas | 22 +- src/screens/UScreenPopup.pas | 148 ++++--- src/screens/UScreenScore.pas | 20 +- src/screens/UScreenSing.pas | 61 +-- src/screens/UScreenSingModi.pas | 32 +- src/screens/UScreenSong.pas | 130 ++++--- src/screens/UScreenSongJumpto.pas | 94 ++--- src/screens/UScreenSongMenu.pas | 39 +- src/screens/UScreenStatDetail.pas | 19 +- src/screens/UScreenStatMain.pas | 42 +- src/screens/UScreenTop5.pas | 20 +- src/screens/UScreenWelcome.pas | 8 +- 34 files changed, 1182 insertions(+), 906 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index def6b7de..b1333b4a 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -35,15 +35,16 @@ interface uses SysUtils, - UMenu, SDL, SDL_Image, + gl, + UMenu, UDisplay, UTexture, - gl, UMusic, UFiles, UThemes, + UPath, UGraphicClasses; type @@ -98,10 +99,10 @@ type Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; - procedure onShow; override; - procedure onHide; override; + procedure OnShow; override; + procedure OnHide; override; procedure DrawCredits; procedure Draw_FunkyText; end; @@ -138,17 +139,17 @@ const OUTRO_EXD_FILE = 'outro-exit-dark.png'; Timings: array[0..21] of cardinal=( - 20, // 0 Delay vor Start + 20, // 0 Delay before 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 + 149, // 1 End first Intro Zoom + 155, // 2 Start 2. Action in Intro + 170, // 3 End Separation in Intro + 271, // 4 beginning Zoomout in Intro 0, // 5 unused - 261, // 6 Start fade-to-white im Intro + 261, // 6 Start fade-to-white in Intro 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Sternchen Main Part + 280, // 8 Start On-Beat-Star Main Part 396, // 9 Start BlindGuard 666, // 10 Start blindy @@ -162,7 +163,7 @@ const 2826, // 18 Ende Whiteshark 3096, // 19 Start FadeOut Mainscreen 3366, // 20 Ende Credits Tune - 60); // 21 start flare im intro + 60); // 21 start flare in intro implementation @@ -176,9 +177,9 @@ uses Textgl, ULanguage, UCommon, - UPath; + UPathUtils; -function TScreenCredits.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenCredits.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -204,38 +205,38 @@ end; constructor TScreenCredits.Create; var - CreditsPath: string; + CreditsPath: IPath; begin inherited Create; - CreditsPath := ResourcesPath + 'credits/'; - - credits_bg_tex := Texture.LoadTexture(CreditsPath + CRDTS_BG_FILE, TEXTURE_TYPE_PLAIN, 0); - credits_bg_ovl := Texture.LoadTexture(CreditsPath + CRDTS_OVL_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - - credits_blindguard := Texture.LoadTexture(CreditsPath + CRDTS_blindguard_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_blindy := Texture.LoadTexture(CreditsPath + CRDTS_blindy_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_canni := Texture.LoadTexture(CreditsPath + CRDTS_canni_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_commandio := Texture.LoadTexture(CreditsPath + CRDTS_commandio_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_lazyjoker := Texture.LoadTexture(CreditsPath + CRDTS_lazyjoker_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_mog := Texture.LoadTexture(CreditsPath + CRDTS_mog_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_mota := Texture.LoadTexture(CreditsPath + CRDTS_mota_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_skillmaster := Texture.LoadTexture(CreditsPath + CRDTS_skillmaster_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - credits_whiteshark := Texture.LoadTexture(CreditsPath + CRDTS_whiteshark_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - - intro_layer01 := Texture.LoadTexture(CreditsPath + INTRO_L01_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer02 := Texture.LoadTexture(CreditsPath + INTRO_L02_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer03 := Texture.LoadTexture(CreditsPath + INTRO_L03_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer04 := Texture.LoadTexture(CreditsPath + INTRO_L04_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer05 := Texture.LoadTexture(CreditsPath + INTRO_L05_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer06 := Texture.LoadTexture(CreditsPath + INTRO_L06_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer07 := Texture.LoadTexture(CreditsPath + INTRO_L07_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer08 := Texture.LoadTexture(CreditsPath + INTRO_L08_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - intro_layer09 := Texture.LoadTexture(CreditsPath + INTRO_L09_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - - outro_bg := Texture.LoadTexture(CreditsPath + OUTRO_BG_FILE, TEXTURE_TYPE_PLAIN, 0); - outro_esc := Texture.LoadTexture(CreditsPath + OUTRO_ESC_FILE, TEXTURE_TYPE_TRANSPARENT, 0); - outro_exd := Texture.LoadTexture(CreditsPath + OUTRO_EXD_FILE, TEXTURE_TYPE_TRANSPARENT, 0); + CreditsPath := ResourcesPath.Append('credits', pdAppend); + + credits_bg_tex := Texture.LoadTexture(CreditsPath.Append(CRDTS_BG_FILE), TEXTURE_TYPE_PLAIN, 0); + credits_bg_ovl := Texture.LoadTexture(CreditsPath.Append(CRDTS_OVL_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + + credits_blindguard := Texture.LoadTexture(CreditsPath.Append(CRDTS_blindguard_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_blindy := Texture.LoadTexture(CreditsPath.Append(CRDTS_blindy_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_canni := Texture.LoadTexture(CreditsPath.Append(CRDTS_canni_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_commandio := Texture.LoadTexture(CreditsPath.Append(CRDTS_commandio_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_lazyjoker := Texture.LoadTexture(CreditsPath.Append(CRDTS_lazyjoker_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_mog := Texture.LoadTexture(CreditsPath.Append(CRDTS_mog_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_mota := Texture.LoadTexture(CreditsPath.Append(CRDTS_mota_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_skillmaster := Texture.LoadTexture(CreditsPath.Append(CRDTS_skillmaster_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + credits_whiteshark := Texture.LoadTexture(CreditsPath.Append(CRDTS_whiteshark_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + + intro_layer01 := Texture.LoadTexture(CreditsPath.Append(INTRO_L01_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer02 := Texture.LoadTexture(CreditsPath.Append(INTRO_L02_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer03 := Texture.LoadTexture(CreditsPath.Append(INTRO_L03_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer04 := Texture.LoadTexture(CreditsPath.Append(INTRO_L04_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer05 := Texture.LoadTexture(CreditsPath.Append(INTRO_L05_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer06 := Texture.LoadTexture(CreditsPath.Append(INTRO_L06_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer07 := Texture.LoadTexture(CreditsPath.Append(INTRO_L07_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer08 := Texture.LoadTexture(CreditsPath.Append(INTRO_L08_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + intro_layer09 := Texture.LoadTexture(CreditsPath.Append(INTRO_L09_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + + outro_bg := Texture.LoadTexture(CreditsPath.Append(OUTRO_BG_FILE), TEXTURE_TYPE_PLAIN, 0); + outro_esc := Texture.LoadTexture(CreditsPath.Append(OUTRO_ESC_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + outro_exd := Texture.LoadTexture(CreditsPath.Append(OUTRO_EXD_FILE), TEXTURE_TYPE_TRANSPARENT, 0); CRDTS_Stage:=InitialDelay; end; @@ -246,7 +247,7 @@ begin Draw := true; end; -procedure TScreenCredits.onShow; +procedure TScreenCredits.OnShow; begin inherited; @@ -255,13 +256,13 @@ begin deluxe_slidein := 0; Credits_Alpha := 0; // Music.SetLoop(true); loop loops not, shit - AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); // thank you wetue + AudioPlayback.Open(soundpath.Append('wome-credits-tune.mp3')); // thank you wetue // Music.Play; CTime := 0; // setlength(CTime_hold,0); end; -procedure TScreenCredits.onHide; +procedure TScreenCredits.OnHide; begin AudioPlayback.Stop; end; @@ -1386,7 +1387,7 @@ begin begin CTime_hold := 0; AudioPlayback.Stop; - AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); + AudioPlayback.Open(SoundPath.Append('credits-outro-tune.mp3')); AudioPlayback.SetVolume(0.2); AudioPlayback.SetLoop(true); AudioPlayback.Play; diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index 5112e17a..2111adef 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -45,8 +45,7 @@ type TextDescriptionLong: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; - PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure InteractNext; override; procedure InteractPrev; override; procedure InteractInc; override; @@ -60,10 +59,10 @@ uses UGraphic, UMusic, USkins, + UUnicodeUtils, SysUtils; -function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: WideChar; - PressedDown: boolean): boolean; +function TScreenEdit.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; begin @@ -75,8 +74,8 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index e4a691cf..b2fb7773 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -25,6 +25,29 @@ unit UScreenEditConvert; +{* + * See + * MIDI Recommended Practice (RP-017): SMF Lyric Meta Event Definition + * http://www.midi.org/techspecs/rp17.php + * MIDI Recommended Practice (RP-026): SMF Language and Display Extensions + * http://www.midi.org/techspecs/rp26.php + * MIDI File Format + * http://www.sonicspot.com/guide/midifiles.html + * KMIDI File Format + * http://gnese.free.fr/Projects/KaraokeTime/Fichiers/karfaq.html + * http://journals.rpungin.fotki.com/karaoke/category/midi + * + * There are two widely spread karaoke formats: + * - KMIDI (.kar), an inofficial midi extension by Tune 1000 + * - Standard Midi files with lyric meta-tags (SMF with lyrics, .mid). + * + * KMIDI uses two tracks, the first just contains a header (mostly track 2) and + * the second the lyrics (track 3). It uses text meta tags for the lyrics. + * SMF uses just one track (normally track 1) and uses lyric meta tags for storage. + * + * Most files are in the KMIDI format. Some Midi files contain both lyric types. + *} + interface {$IFDEF FPC} @@ -45,10 +68,11 @@ uses USongs, USong, UMusic, - UThemes; + UThemes, + UPath; type - TNote = record + TMidiNote = record Event: integer; EventType: integer; Channel: integer; @@ -56,70 +80,65 @@ type Len: real; Data1: integer; Data2: integer; - Str: string; + Str: UTF8String; // normally ASCII end; + TLyricType = (ltKMIDI, ltSMFLyric); + TTrack = record - Note: array of TNote; - Name: string; - Hear: boolean; - Status: set of (notes, lyrics); + Note: array of TMidiNote; + Name: UTF8String; // normally ASCII + Status: set of (tsNotes, tsLyrics); //< track contains notes, lyrics or both + LyricType: set of TLyricType; + NoteType: (ntNone, ntAvail); end; - TNuta = record + TNote = record Start: integer; Len: integer; Tone: integer; - Lyric: string; + Lyric: UTF8String; NewSentence: boolean; end; TArrayTrack = array of TTrack; TScreenEditConvert = class(TMenu) - public - ATrack: TArrayTrack; // actual track -// Track: TArrayTrack; - Channel: TArrayTrack; + private + Tracks: TArrayTrack; // current track ColR: array[0..100] of real; ColG: array[0..100] of real; ColB: array[0..100] of real; Len: real; - Sel: integer; - Selected: boolean; -// FileName: string; + SelTrack: integer; // index of selected track + fFileName: IPath; {$IFDEF UseMIDIPort} MidiFile: TMidiFile; - MidiTrack: TMidiTrack; - MidiEvent: pMidiEvent; MidiOut: TMidiOutput; {$ENDIF} - - Song: TSong; - Lines: TLines; + BPM: real; Ticks: real; - Note: array of TNuta; + Note: array of TNote; - procedure AddLyric(Start: integer; Text: string); - procedure Extract; + procedure AddLyric(Start: integer; LyricType: TLyricType; Text: UTF8String); + procedure Extract(out Song: TSong; out Lines: TLines); {$IFDEF UseMIDIPort} procedure MidiFile1MidiEvent(event: PMidiEvent); {$ENDIF} - - function SelectedNumber: integer; + + function CountSelectedTracks: integer; + + public constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + procedure OnShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; - procedure onHide; override; + procedure OnHide; override; end; -var - ConversionFileName: string; - implementation uses @@ -131,17 +150,42 @@ uses UGraphic, UIni, UMain, - UPath, - USkins; - -function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; + UPathUtils, + USkins, + ULanguage, + UTextEncoding, + UUnicodeUtils; + +const + // MIDI/KAR lyrics are specified to be ASCII only. + // Assume backward compatible CP1252 encoding. + DEFAULT_ENCODING = encCP1252; + +const + MIDI_EVENTTYPE_NOTEOFF = $8; + MIDI_EVENTTYPE_NOTEON = $9; + MIDI_EVENTTYPE_META_SYSEX = $F; + + MIDI_EVENT_META = $FF; + MIDI_META_TEXT = $1; + MIDI_META_LYRICS = $5; + +function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +{$IFDEF UseMIDIPort} +var + SResult: TSaveSongResult; + Playing: boolean; + MidiTrack: TMidiTrack; + Song: TSong; + Lines: TLines; +{$ENDIF} begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -153,9 +197,10 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - {$IFDEF UseMIDIPort} - MidiFile.StopPlaying; - {$ENDIF} + {$IFDEF UseMIDIPort} + if (MidiFile <> nil) then + MidiFile.StopPlaying; + {$ENDIF} AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenEdit); end; @@ -165,70 +210,97 @@ begin if Interaction = 0 then begin AudioPlayback.PlaySound(SoundLib.Start); + ScreenOpen.Filename := GamePath.Append('file.mid'); ScreenOpen.BackScreen := @ScreenEditConvert; FadeTo(@ScreenOpen); - end; - - if Interaction = 1 then + end + else if Interaction = 1 then begin - Selected := false; - {$IFDEF UseMIDIPort} - MidiFile.OnMidiEvent := MidiFile1MidiEvent; -// MidiFile.GoToTime(MidiFile.GetTrackLength div 2); - MidiFile.StartPlaying; + {$IFDEF UseMIDIPort} + if (MidiFile <> nil) then + begin + MidiFile.OnMidiEvent := MidiFile1MidiEvent; + //MidiFile.GoToTime(MidiFile.GetTrackLength div 2); + MidiFile.StartPlaying; + end; {$ENDIF} - end; - - if Interaction = 2 then + end + else if Interaction = 2 then begin - Selected := true; {$IFDEF UseMIDIPort} - MidiFile.OnMidiEvent := nil; - {$ENDIF} - {for T := 0 to High(ATrack) do + if (MidiFile <> nil) then begin - if ATrack[T].Hear then - begin - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - end; + MidiFile.OnMidiEvent := nil; + MidiFile.StartPlaying; end; - MidiFile.StartPlaying;//} - end; - - if Interaction = 3 then + {$ENDIF} + end + else if Interaction = 3 then begin - if SelectedNumber > 0 then + {$IFDEF UseMIDIPort} + if CountSelectedTracks > 0 then + begin + Extract(Song, Lines); + SResult := SaveSong(Song, Lines, fFileName.SetExtension('.txt'), + false); + FreeAndNil(Song); + if (SResult = ssrOK) then + ScreenPopupInfo.ShowPopup(Language.Translate('INFO_FILE_SAVED')) + else + ScreenPopupError.ShowPopup(Language.Translate('ERROR_SAVE_FILE_FAILED')); + end + else begin - Extract; - SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false); + ScreenPopupError.ShowPopup(Language.Translate('EDITOR_ERROR_NO_TRACK_SELECTED')); end; + {$ENDIF} end; end; SDLK_SPACE: begin -// ATrack[Sel].Hear := not ATrack[Sel].Hear; - if Notes in ATrack[Sel].Status then + {$IFDEF UseMIDIPort} + if (MidiFile <> nil) then begin - ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; - if Lyrics in ATrack[Sel].Status then - ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] - else - ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; - end - else - ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; + if (Tracks[SelTrack].NoteType = ntAvail) and + (Tracks[SelTrack].LyricType <> []) then + begin + if (Tracks[SelTrack].Status = []) then + Tracks[SelTrack].Status := [tsNotes] + else if (Tracks[SelTrack].Status = [tsNotes]) then + Tracks[SelTrack].Status := [tsLyrics] + else if (Tracks[SelTrack].Status = [tsLyrics]) then + Tracks[SelTrack].Status := [tsNotes, tsLyrics] + else if (Tracks[SelTrack].Status = [tsNotes, tsLyrics]) then + Tracks[SelTrack].Status := []; + end + else if (Tracks[SelTrack].NoteType = ntAvail) then + begin + if (Tracks[SelTrack].Status = []) then + Tracks[SelTrack].Status := [tsNotes] + else + Tracks[SelTrack].Status := []; + end + else if (Tracks[SelTrack].LyricType <> []) then + begin + if (Tracks[SelTrack].Status = []) then + Tracks[SelTrack].Status := [tsLyrics] + else + Tracks[SelTrack].Status := []; + end; -{ if Selected then - begin - MidiTrack := MidiFile.GetTrack(Sel); - if Track[Sel].Hear then + Playing := (MidiFile.GetCurrentTime > 0); + MidiFile.StopPlaying(); + MidiTrack := MidiFile.GetTrack(SelTrack); + if tsNotes in Tracks[SelTrack].Status then MidiTrack.OnMidiEvent := MidiFile1MidiEvent else MidiTrack.OnMidiEvent := nil; - end;} + if (Playing) then + MidiFile.ContinuePlaying(); + end; + {$ENDIF} end; SDLK_RIGHT: @@ -243,102 +315,161 @@ begin SDLK_DOWN: begin - Inc(Sel); - if Sel > High(ATrack) then - Sel := 0; + Inc(SelTrack); + if SelTrack > High(Tracks) then + SelTrack := 0; end; SDLK_UP: begin - Dec(Sel); - if Sel < 0 then - Sel := High(ATrack); + Dec(SelTrack); + if SelTrack < 0 then + SelTrack := High(Tracks); end; end; end; end; -procedure TScreenEditConvert.AddLyric(Start: integer; Text: string); +procedure TScreenEditConvert.AddLyric(Start: integer; LyricType: TLyricType; Text: UTF8String); var N: integer; begin - for N := 0 to High(Note) do + // find corresponding note + N := 0; + while (N <= High(Note)) do begin if Note[N].Start = Start then - begin - // check for new sentece - if Copy(Text, 1, 1) = '\' then - Delete(Text, 1, 1); - if Copy(Text, 1, 1) = '/' then - begin - Delete(Text, 1, 1); - Note[N].NewSentence := true; - end; + Break; + Inc(N); + end; - // overwrite lyric od append - if Note[N].Lyric = '-' then - Note[N].Lyric := Text - else - Note[N].Lyric := Note[N].Lyric + Text; + // check if note was found + if (N > High(Note)) then + Exit; + + // set text + if (LyricType = ltKMIDI) then + begin + // end of paragraph + if Copy(Text, 1, 1) = '\' then + begin + Delete(Text, 1, 1); + end + // end of line + else if Copy(Text, 1, 1) = '/' then + begin + Delete(Text, 1, 1); + Note[N].NewSentence := true; + end; + end + else // SMFLyric + begin + // Line Feed -> end of paragraph + if Copy(Text, 1, 1) = #$0A then + begin + Delete(Text, 1, 1); + end + // Carriage Return -> end of line + else if Copy(Text, 1, 1) = #$0D then + begin + Delete(Text, 1, 1); + Note[N].NewSentence := true; end; end; + + // overwrite lyric or append + if Note[N].Lyric = '-' then + Note[N].Lyric := Text + else + Note[N].Lyric := Note[N].Lyric + Text; end; -procedure TScreenEditConvert.Extract; +procedure TScreenEditConvert.Extract(out Song: TSong; out Lines: TLines); + var T: integer; C: integer; N: integer; Nu: integer; - NoteTemp: TNuta; + NoteTemp: TNote; Move: integer; Max, Min: integer; + LyricType: TLyricType; + Text: UTF8String; begin // song info - Song.Title := ''; - Song.Artist := ''; - Song.Mp3 := ''; + Song := TSong.Create(); + Song.Clear(); Song.Resolution := 4; SetLength(Song.BPM, 1); Song.BPM[0].BPM := BPM*4; - SetLength(Note, 0); // extract notes - for T := 0 to High(ATrack) do + for T := 0 to High(Tracks) do begin -// if ATrack[T].Hear then -// begin - if Notes in ATrack[T].Status then + if tsNotes in Tracks[T].Status then begin - for N := 0 to High(ATrack[T].Note) do + for N := 0 to High(Tracks[T].Note) do begin - if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then + if (Tracks[T].Note[N].EventType = MIDI_EVENTTYPE_NOTEON) and + (Tracks[T].Note[N].Data2 > 0) then begin Nu := Length(Note); SetLength(Note, Nu + 1); - Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); - Note[Nu].Len := Round(ATrack[T].Note[N].Len / Ticks); - Note[Nu].Tone := ATrack[T].Note[N].Data1 - 12*5; + Note[Nu].Start := Round(Tracks[T].Note[N].Start / Ticks); + Note[Nu].Len := Round(Tracks[T].Note[N].Len / Ticks); + Note[Nu].Tone := Tracks[T].Note[N].Data1 - 12*5; Note[Nu].Lyric := '-'; end; end; end; end; - // extract lyrics - for T := 0 to High(ATrack) do + // extract lyrics (and artist + title info) + for T := 0 to High(Tracks) do begin -// if ATrack[T].Hear then -// begin - if Lyrics in ATrack[T].Status then + if not (tsLyrics in Tracks[T].Status) then + Continue; + + for N := 0 to High(Tracks[T].Note) do begin - for N := 0 to High(ATrack[T].Note) do + if (Tracks[T].Note[N].Event = MIDI_EVENT_META) then begin - if (ATrack[T].Note[N].EventType = 15) then + // determine and validate lyric meta tag + if (ltKMIDI in Tracks[T].LyricType) and + (Tracks[T].Note[N].Data1 = MIDI_META_TEXT) then begin -// Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); - AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); + Text := Tracks[T].Note[N].Str; + + // check for meta info + if (Length(Text) > 2) and (Text[1] = '@') then + begin + case Text[2] of + 'L': Song.Language := Copy(Text, 3, Length(Text)); // language + 'T': begin // title info + if (Song.Artist = '') then + Song.Artist := Copy(Text, 3, Length(Text)) + else if (Song.Title = '') then + Song.Title := Copy(Text, 3, Length(Text)); + end; + end; + Continue; + end; + + LyricType := ltKMIDI; + end + else if (ltSMFLyric in Tracks[T].LyricType) and + (Tracks[T].Note[N].Data1 = MIDI_META_LYRICS) then + begin + LyricType := ltSMFLyric; + end + else + begin + // unknown meta event + Continue; end; + + AddLyric(Round(Tracks[T].Note[N].Start / Ticks), LyricType, Tracks[T].Note[N].Str); end; end; end; @@ -360,8 +491,12 @@ begin // copy notes SetLength(Lines.Line, 1); - Lines.Number := 1; - Lines.High := 0; + Lines.Number := 1; + Lines.High := 0; + Lines.Current := 0; + Lines.Resolution := 0; + Lines.NotesGAP := 0; + Lines.ScoreValue := 0; C := 0; N := 0; @@ -403,35 +538,37 @@ begin // create space for new note SetLength(Lines.Line[C].Note, Length(Lines.Line[C].Note)+1); + Inc(Lines.Line[C].HighNote); // initialize note Lines.Line[C].Note[N].Start := Note[Nu].Start; Lines.Line[C].Note[N].Length := Note[Nu].Len; Lines.Line[C].Note[N].Tone := Note[Nu].Tone; - Lines.Line[C].Note[N].Text := Note[Nu].Lyric; - //All Notes are Freestyle when Converted Fix: + Lines.Line[C].Note[N].Text := DecodeStringUTF8(Note[Nu].Lyric, DEFAULT_ENCODING); Lines.Line[C].Note[N].NoteType := ntNormal; Inc(N); end; end; -function TScreenEditConvert.SelectedNumber: integer; +function TScreenEditConvert.CountSelectedTracks: integer; var T: integer; // track begin Result := 0; - for T := 0 to High(ATrack) do -// if ATrack[T].Hear then -// Inc(Result); - if Notes in ATrack[T].Status then + for T := 0 to High(Tracks) do + if tsNotes in Tracks[T].Status then Inc(Result); end; {$IFDEF UseMIDIPort} procedure TScreenEditConvert.MidiFile1MidiEvent(event: PMidiEvent); begin -// Log.LogStatus(IntToStr(event.event), 'MIDI'); - MidiOut.PutShort(event.event, event.data1, event.data2); + //Log.LogStatus(IntToStr(event.event), 'MIDI'); + try + MidiOut.PutShort(event.event, event.data1, event.data2); + except + MidiFile.StopPlaying(); + end; end; {$ENDIF} @@ -442,7 +579,7 @@ begin inherited Create; AddButton(40, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(15, 5, 0, 0, 0, 'Open'); -// Button[High(Button)].Text[0].Size := 11; + //Button[High(Button)].Text[0].Size := 11; AddButton(160, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(25, 5, 0, 0, 0, 'Play'); @@ -453,19 +590,7 @@ begin AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(20, 5, 0, 0, 0, 'Save'); -{ MidiOut := TMidiOutput.Create(nil); -// MidiOut.Close; -// MidiOut.DeviceID := 0; - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - Log.LogStatus(MidiOut.ProductName, 'MIDI'); - MidiOut.Open; -// MidiOut.SetVolume(100, 100); // temporary} - - ConversionFileName := GamePath + 'file.mid'; - {$IFDEF UseMIDIPort} - MidiFile := TMidiFile.Create(nil); - {$ENDIF} + fFileName := PATH_NONE; for P := 0 to 100 do begin @@ -476,96 +601,124 @@ begin end; -procedure TScreenEditConvert.onShow; +procedure TScreenEditConvert.OnShow; var T: integer; // track N: integer; // note - C: integer; // channel - CN: integer; // channel note + {$IFDEF UseMIDIPort} + MidiTrack: TMidiTrack; + MidiEvent: PMidiEvent; + {$ENDIF} + FileOpened: boolean; + KMIDITrackIndex, SMFTrackIndex: integer; begin inherited; + Interaction := 0; + {$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table - Log.LogStatus(MidiOut.ProductName, 'MIDI'); + Log.LogInfo(MidiOut.ProductName, 'MIDI'); MidiOut.Open; + MidiFile := nil; + SetLength(Tracks, 0); + + // Filename is only <> PATH_NONE if we called the OpenScreen before + fFilename := ScreenOpen.Filename; + if (fFilename = PATH_NONE) then + Exit; + ScreenOpen.Filename := PATH_NONE; - if FileExists(ConversionFileName) then + FileOpened := false; + if fFileName.Exists then begin - MidiFile.Filename := ConversionFileName; - MidiFile.ReadFile; + MidiFile := TMidiFile.Create(nil); + MidiFile.Filename := fFileName; + try + MidiFile.ReadFile; + FileOpened := true; + except + MidiFile.Free; + end; + end; - Len := 0; - Sel := 0; - BPM := MidiFile.Bpm; - Ticks := MidiFile.TicksPerQuarter / 4; + if (not FileOpened) then + begin + ScreenPopupError.ShowPopup(Language.Translate('ERROR_FILE_NOT_FOUND')); + Exit; + end; -{ for T := 0 to MidiFile.NumberOfTracks-1 do - begin - SetLength(Track, Length(Track)+1); - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - Track[T].Name := MidiTrack.getName; + Len := 0; + SelTrack := 0; + BPM := MidiFile.Bpm; + Ticks := MidiFile.TicksPerQuarter / 4; - for N := 0 to MidiTrack.getEventCount-1 do - begin - SetLength(Track[T].Note, Length(Track[T].Note)+1); - MidiEvent := MidiTrack.GetEvent(N); - Track[T].Note[N].Start := MidiEvent.time; - Track[T].Note[N].Len := MidiEvent.len; - Track[T].Note[N].Event := MidiEvent.event; - Track[T].Note[N].EventType := MidiEvent.event div 16; - Track[T].Note[N].Channel := MidiEvent.event and 15; - Track[T].Note[N].Data1 := MidiEvent.data1; - Track[T].Note[N].Data2 := MidiEvent.data2; - Track[T].Note[N].Str := MidiEvent.str; - - if Track[T].Note[N].Start + Track[T].Note[N].Len > Len then - Len := Track[T].Note[N].Start + Track[T].Note[N].Len; - end; - end;} + KMIDITrackIndex := -1; + SMFTrackIndex := -1; - SetLength(Channel, 16); - for T := 0 to 15 do - begin - Channel[T].Name := IntToStr(T+1); - SetLength(Channel[T].Note, 0); - Channel[T].Status := []; - end; + SetLength(Tracks, MidiFile.NumberOfTracks); + for T := 0 to MidiFile.NumberOfTracks-1 do + Tracks[T].LyricType := []; - for T := 0 to MidiFile.NumberOfTracks-1 do + for T := 0 to MidiFile.NumberOfTracks-1 do + begin + MidiTrack := MidiFile.GetTrack(T); + MidiTrack.OnMidiEvent := nil; + Tracks[T].Name := DecodeStringUTF8(MidiTrack.getName, DEFAULT_ENCODING); + Tracks[T].NoteType := ntNone; + Tracks[T].Status := []; + + SetLength(Tracks[T].Note, MidiTrack.getEventCount()); + for N := 0 to MidiTrack.getEventCount-1 do begin - MidiTrack := MidiFile.GetTrack(T); - MidiTrack.OnMidiEvent := MidiFile1MidiEvent; - - for N := 0 to MidiTrack.getEventCount-1 do + MidiEvent := MidiTrack.GetEvent(N); + + Tracks[T].Note[N].Start := MidiEvent.time; + Tracks[T].Note[N].Len := MidiEvent.len; + Tracks[T].Note[N].Event := MidiEvent.event; + Tracks[T].Note[N].EventType := MidiEvent.event shr 4; + Tracks[T].Note[N].Channel := MidiEvent.event and $0F; + Tracks[T].Note[N].Data1 := MidiEvent.data1; + Tracks[T].Note[N].Data2 := MidiEvent.data2; + Tracks[T].Note[N].Str := DecodeStringUTF8(MidiEvent.str, DEFAULT_ENCODING); + + if (Tracks[T].Note[N].Event = MIDI_EVENT_META) then + begin + case (Tracks[T].Note[N].Data1) of + MIDI_META_TEXT: begin + // KMIDI lyrics (uses MIDI_META_TEXT events) + if (StrLComp(PAnsiChar(Tracks[T].Note[N].Str), '@KMIDI KARAOKE FILE', 19) = 0) and + (High(Tracks) >= T+1) then + begin + // The '@KMIDI ...' mark is in the first track (mostly named 'Soft Karaoke') + // but the lyrics are in the second track (named 'Words') + Tracks[T+1].LyricType := Tracks[T+1].LyricType + [ltKMIDI]; + KMIDITrackIndex := T+1; + end; + end; + MIDI_META_LYRICS: begin + // lyrics in Standard Midi File format found (uses MIDI_META_LYRICS events) + Tracks[T].LyricType := Tracks[T].LyricType + [ltSMFLyric]; + SMFTrackIndex := T; + end; + end; + end + else if (Tracks[T].Note[N].EventType = MIDI_EVENTTYPE_NOTEON) then begin - MidiEvent := MidiTrack.GetEvent(N); - C := MidiEvent.event and 15; - - CN := Length(Channel[C].Note); - SetLength(Channel[C].Note, CN+1); - - Channel[C].Note[CN].Start := MidiEvent.time; - Channel[C].Note[CN].Len := MidiEvent.len; - Channel[C].Note[CN].Event := MidiEvent.event; - Channel[C].Note[CN].EventType := MidiEvent.event div 16; - Channel[C].Note[CN].Channel := MidiEvent.event and 15; - Channel[C].Note[CN].Data1 := MidiEvent.data1; - Channel[C].Note[CN].Data2 := MidiEvent.data2; - Channel[C].Note[CN].Str := MidiEvent.str; - - if Channel[C].Note[CN].Start + Channel[C].Note[CN].Len > Len then - Len := Channel[C].Note[CN].Start + Channel[C].Note[CN].Len; + // notes available + Tracks[T].NoteType := ntAvail; end; - end; - ATrack := Channel; + if Tracks[T].Note[N].Start + Tracks[T].Note[N].Len > Len then + Len := Tracks[T].Note[N].Start + Tracks[T].Note[N].Len; + end; end; - Interaction := 0; + // set default lyric track. Prefer KMIDI. + if (KMIDITrackIndex > -1) then + Tracks[KMIDITrackIndex].Status := Tracks[KMIDITrackIndex].Status + [tsLyrics] + else if (SMFTrackIndex > -1) then + Tracks[SMFTrackIndex].Status := Tracks[SMFTrackIndex].Status + [tsLyrics]; {$ENDIF} end; @@ -578,41 +731,44 @@ var Y: real; Height: real; YSkip: real; + TrackName: UTF8String; begin // draw static menu inherited Draw; Y := 100; - Height := min(480, 40 * Length(ATrack)); + Height := min(480, 40 * Length(Tracks)); Bottom := Y + Height; - if Length(ATrack) = 0 then // prevent crash with uncomplete code. - begin - Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0'); - YSkip := 40; - end - else - YSkip := Height / Length(ATrack); + YSkip := Height / Length(Tracks); - // select - DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + // highlight selected track + DrawQuad(10, Y+SelTrack*YSkip, 780, YSkip, 0.8, 0.8, 0.8); - // selected - now me use Status System - for Count := 0 to High(ATrack) do - if ATrack[Count].Hear then + // track-selection info + for Count := 0 to High(Tracks) do + if Tracks[Count].Status <> [] then DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); - for Count := 0 to High(ATrack) do + for Count := 0 to High(Tracks) do begin - if Notes in ATrack[Count].Status then + if Tracks[Count].NoteType = ntAvail then begin + if tsNotes in Tracks[Count].Status then + glColor3f(0, 0, 0) + else + glColor3f(0.7, 0.7, 0.7); SetFontPos(25, Y + Count*YSkip + 10); SetFontSize(15); glPrint('N'); end; - if Lyrics in ATrack[Count].Status then + if Tracks[Count].LyricType <> [] then begin + if tsLyrics in Tracks[Count].Status then + glColor3f(0, 0, 0) + else + glColor3f(0.7, 0.7, 0.7); SetFontPos(40, Y + Count*YSkip + 10); SetFontSize(15); glPrint('L'); @@ -623,51 +779,48 @@ begin DrawLine( 60, Y, 60, Bottom, 0, 0, 0); DrawLine(790, Y, 790, Bottom, 0, 0, 0); - for Count := 0 to Length(ATrack) do + for Count := 0 to Length(Tracks) do DrawLine(10, Y + Count*YSkip, 790, Y + Count*YSkip, 0, 0, 0); - for Count := 0 to High(ATrack) do + for Count := 0 to High(Tracks) do begin - SetFontPos(11, Y + 10 + Count*YSkip); + SetFontPos(65, Y + Count*YSkip); SetFontSize(15); - glPrint(ATrack[Count].Name); + glPrint(Tracks[Count].Name); end; - for Count := 0 to High(ATrack) do - for Count2 := 0 to High(ATrack[Count].Note) do + for Count := 0 to High(Tracks) do + begin + for Count2 := 0 to High(Tracks[Count].Note) do begin - if ATrack[Count].Note[Count2].EventType = 9 then - DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, - 3, - 3, - ColR[Count], - ColG[Count], - ColB[Count]); - if ATrack[Count].Note[Count2].EventType = 15 then - DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + 0.75*YSkip + Count*YSkip, - 60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + YSkip + Count*YSkip, - ColR[Count], - ColG[Count], - ColB[Count]); + if Tracks[Count].Note[Count2].EventType = MIDI_EVENTTYPE_NOTEON then + DrawQuad(60 + Tracks[Count].Note[Count2].Start/Len * 725, + Y + (Count+1)*YSkip - Tracks[Count].Note[Count2].Data1*35/127, + 3, 3, + ColR[Count], ColG[Count], ColB[Count]); + if Tracks[Count].Note[Count2].EventType = 15 then + DrawLine(60 + Tracks[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, + 60 + Tracks[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, + ColR[Count], ColG[Count], ColB[Count]); end; + end; // playing line {$IFDEF UseMIDIPort} - X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; + if (MidiFile <> nil) then + X := 60 + MidiFile.GetCurrentTime/MidiFile.GetTrackLength*730; {$ENDIF} DrawLine(X, Y, X, Bottom, 0.3, 0.3, 0.3); Result := true; end; -procedure TScreenEditConvert.onHide; +procedure TScreenEditConvert.OnHide; begin {$IFDEF UseMIDIPort} + FreeAndNil(MidiFile); MidiOut.Close; - MidiOut.Free; + FreeAndNil(MidiOut); {$ENDIF} end; diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index ad0fc40a..c581215b 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -38,6 +38,7 @@ uses SDL, USongs, USong, + UPath, UThemes; type @@ -72,8 +73,8 @@ type procedure SetRoundButtons; constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + procedure OnShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; { function Draw: boolean; override; procedure Finish;} end; @@ -86,17 +87,18 @@ uses SysUtils, UFiles, USkins, - UTexture; + UTexture, + UUnicodeUtils; -function TScreenEditHeader.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenEditHeader.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var T: integer; begin Result := true; if (PressedDown) then // Key Down begin // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -105,10 +107,10 @@ begin // check special keys case PressedKey of - SDLK_ESCAPE : + SDLK_ESCAPE: begin -// Music.PlayBack; -// FadeTo(@MainScreen); + //Music.PlayBack; + //FadeTo(@MainScreen); Result := false; end; @@ -116,7 +118,7 @@ begin begin if Interaction = 1 then begin -// Save; + //Save; end; end; @@ -159,19 +161,19 @@ begin T := Interaction - 2 + TextTitle; if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then begin - Text[T].DeleteLastL; + Text[T].DeleteLastLetter; SetRoundButtons; end; end; end; case CharCode of - #32..#255: + 32..255: begin if (Interaction >= 2) and (Interaction <= 13) then begin Text[Interaction - 2 + TextTitle].Text := - Text[Interaction - 2 + TextTitle].Text + CharCode; + Text[Interaction - 2 + TextTitle].Text + UCS4ToUTF8String(CharCode); SetRoundButtons; end; end; @@ -223,18 +225,18 @@ begin TextGAP := AddText(340, 110 + 13*30, 0, 30, 0, 0, 0, ''); TextBPM := AddText(340, 110 + 14*30, 0, 30, 0, 0, 0, ''); - StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); - StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, 'RoundButton', TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticTitle := AddStatic(130, 115 + 0*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticArtist := AddStatic(130, 115 + 1*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticMp3 := AddStatic(130, 115 + 2*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBackground := AddStatic(130, 115 + 4*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideo := AddStatic(130, 115 + 5*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticVideoGAP := AddStatic(130, 115 + 6*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticRelative := AddStatic(130, 115 + 8*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticResolution := AddStatic(130, 115 + 9*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticNotesGAP := AddStatic(130, 115 + 10*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticStart := AddStatic(130, 115 + 12*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticGAP := AddStatic(130, 115 + 13*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); + StaticBPM := AddStatic(130, 115 + 14*30, 20, 20, 1, 1, 1, Path('RoundButton'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); AddInteraction(iText, TextTitle); AddInteraction(iText, TextArtist); @@ -250,7 +252,7 @@ begin AddInteraction(iText, TextBPM); end; -procedure TScreenEditHeader.onShow; +procedure TScreenEditHeader.OnShow; begin inherited; diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 3e1f3c1c..00e62c16 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -116,11 +116,11 @@ type Tex_Background: TTexture; FadeOut: boolean; constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - function ParseInputEditText(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; + procedure OnShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInputEditText(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; function Draw: boolean; override; - procedure onHide; override; + procedure OnHide; override; end; implementation @@ -130,14 +130,44 @@ uses UDraw, UNote, USkins, - ULanguage; + ULanguage, + UTextEncoding, + UUnicodeUtils, + UPath; + + +procedure OnSaveEncodingError(Value: boolean; Data: Pointer); +var + SResult: TSaveSongResult; + FilePath: IPath; + Success: boolean; +begin + Success := false; + if (Value) then + begin + CurrentSong.Encoding := encUTF8; + FilePath := CurrentSong.Path.Append(CurrentSong.FileName); + // create backup file + FilePath.CopyFile(Path(FilePath.ToUTF8 + '.ansi.bak'), false); + // store in UTF-8 encoding + SResult := SaveSong(CurrentSong, Lines[0], FilePath, + boolean(Data)); + Success := (SResult = ssrOK); + end; + + if (Success) then + ScreenPopupInfo.ShowPopup(Language.Translate('INFO_FILE_SAVED')) + else + ScreenPopupError.ShowPopup(Language.Translate('ERROR_SAVE_FILE_FAILED')); +end; // Method for input parsing. If false is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; R: real; + SResult: TSaveSongResult; begin Result := true; @@ -152,40 +182,47 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); if (PressedDown) then // Key Down - begin // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + begin + // check normal keys + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; end; - 'S': + Ord('S'): begin // Save Song - if SDL_ModState = KMOD_LSHIFT then - SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, true) + SResult := SaveSong(CurrentSong, Lines[0], CurrentSong.Path.Append(CurrentSong.FileName), + (SDL_ModState = KMOD_LSHIFT)); + if (SResult = ssrOK) then + begin + ScreenPopupInfo.ShowPopup(Language.Translate('INFO_FILE_SAVED')); + end + else if (SResult = ssrEncodingError) then + begin + ScreenPopupCheck.ShowPopup(Language.Translate('ENCODING_ERROR_ASK_FOR_UTF8'), OnSaveEncodingError, + Pointer(SDL_ModState = KMOD_LSHIFT), true); + end else - SaveSong(CurrentSong, Lines[0], CurrentSong.Path + CurrentSong.FileName, false); - - {if SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL + KMOD_LALT then - // Save Song - SaveSongDebug(CurrentSong, Lines[0], 'C:\song.asm', false);} - + begin + ScreenPopupError.ShowPopup(Language.Translate('ERROR_SAVE_FILE_FAILED')); + end; Exit; end; - 'D': + Ord('D'): begin // Divide lengths by 2 DivideBPM; Exit; end; - 'M': + Ord('M'): begin // Multiply lengths by 2 MultiplyBPM; Exit; end; - 'C': + Ord('C'): begin // Capitalize letter at the beginning of line if SDL_ModState = 0 then @@ -201,7 +238,7 @@ begin Exit; end; - 'V': + Ord('V'): begin // Paste text if SDL_ModState = KMOD_LCTRL then @@ -217,13 +254,13 @@ begin CopySentence(CopySrc, Lines[0].Current); end; end; - 'T': + Ord('T'): begin // Fixes timings between sentences FixTimings; Exit; end; - 'P': + Ord('P'): begin if SDL_ModState = 0 then begin @@ -269,8 +306,8 @@ begin Exit; end; - // Golden Note Patch - 'G': + // Golden Note + Ord('G'): begin if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntGolden) then Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal @@ -280,8 +317,8 @@ begin Exit; end; - // Freestyle Note Patch - 'F': + // Freestyle Note + Ord('F'): begin if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntFreestyle) then Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal @@ -580,10 +617,11 @@ begin // skip to next sentence if SDL_ModState = 0 then - begin {$IFDEF UseMIDIPort} + begin + {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; - {$endif} + {$ENDIF} Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(Lines[0].Current); @@ -642,7 +680,7 @@ begin end; // if end; -function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; begin @@ -653,7 +691,16 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); if (PressedDown) then - begin // Key Down + begin + // check normal keys + if (IsPrintableChar(CharCode)) then + begin + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text := + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text + UCS4ToUTF8String(CharCode); + Exit; + end; + + // check special keys case PressedKey of SDLK_ESCAPE: @@ -665,15 +712,10 @@ begin // Exit Text Edit Mode TextEditMode := false; end; - SDLK_0..SDLK_9, SDLK_A..SDLK_Z, SDLK_SPACE, SDLK_MINUS, SDLK_EXCLAIM, SDLK_COMMA, SDLK_SLASH, SDLK_ASTERISK, SDLK_QUESTION, SDLK_QUOTE, SDLK_QUOTEDBL: - begin - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text := - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text + CharCode; - end; SDLK_BACKSPACE: begin - Delete(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text, - Length(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text), 1); + UTF8Delete(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text, + LengthUTF8(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text), 1); end; SDLK_RIGHT: begin @@ -758,9 +800,11 @@ var S: string; begin // temporary -{ for C := 0 to Lines[0].High do + { + for C := 0 to Lines[0].High do for N := 0 to Lines[0].Line[C].HighNut do - Lines[0].Line[C].Note[N].Text := AnsiLowerCase(Lines[0].Line[C].Note[N].Text);} + Lines[0].Line[C].Note[N].Text := UTF8LowerCase(Lines[0].Line[C].Note[N].Text); + } for C := 0 to Lines[0].High do begin @@ -1085,14 +1129,16 @@ var N: integer; NHigh: integer; begin -{ C := Lines[0].Current; + { + C := Lines[0].Current; for N := Lines[0].Line[C].HighNut downto 1 do begin Lines[0].Line[C].Note[N].Text := Lines[0].Line[C].Note[N-1].Text; end; // for - Lines[0].Line[C].Note[0].Text := '- ';} + Lines[0].Line[C].Note[0].Text := '- '; + } C := Lines[0].Current; NHigh := Lines[0].Line[C].HighNote; @@ -1233,21 +1279,24 @@ begin end; -procedure TScreenEditSub.onShow; +procedure TScreenEditSub.OnShow; +var + FileExt: IPath; begin inherited; - Log.LogStatus('Initializing', 'TEditScreen.onShow'); + Log.LogStatus('Initializing', 'TEditScreen.OnShow'); Lyric := TEditorLyrics.Create; ResetSingTemp; try - //Check if File is XML - if copy(CurrentSong.FileName,length(CurrentSong.FileName)-3,4) = '.xml' then - Error := not CurrentSong.LoadXMLSong() - else - Error := not CurrentSong.LoadSong(); + //Check if File is XML + FileExt := CurrentSong.FileName.GetExtension; + if FileExt.ToUTF8 = '.xml' then + Error := not CurrentSong.LoadXMLSong() + else + Error := not CurrentSong.LoadSong(); except Error := true; end; @@ -1269,12 +1318,12 @@ begin {$ENDIF} Text[TextTitle].Text := CurrentSong.Title; Text[TextArtist].Text := CurrentSong.Artist; - Text[TextMp3].Text := CurrentSong.Mp3; + Text[TextMp3].Text := CurrentSong.Mp3.ToUTF8; Lines[0].Current := 0; CurrentNote := 0; Lines[0].Line[0].Note[0].Color := 1; - AudioPlayback.Open(CurrentSong.Path + CurrentSong.Mp3); + AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(0.4); @@ -1412,7 +1461,7 @@ begin Result := true; end; -procedure TScreenEditSub.onHide; +procedure TScreenEditSub.OnHide; begin {$IFDEF UseMIDIPort} MidiOut.Close; diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index b41a8535..4d7d8b5e 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -46,8 +46,8 @@ type TScreenLevel = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -58,16 +58,17 @@ uses UMain, UIni, USong, - UTexture; + UTexture, + UUnicodeUtils; -function TScreenLevel.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenLevel.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -119,7 +120,7 @@ begin Interaction := 0; end; -procedure TScreenLevel.onShow; +procedure TScreenLevel.OnShow; begin inherited; diff --git a/src/screens/UScreenLoading.pas b/src/screens/UScreenLoading.pas index ea639ba3..e368f181 100644 --- a/src/screens/UScreenLoading.pas +++ b/src/screens/UScreenLoading.pas @@ -43,10 +43,11 @@ uses type TScreenLoading = class(TMenu) public - Fadeout: boolean; + Fadeout: boolean; + constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + procedure OnShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; end; implementation @@ -55,7 +56,7 @@ uses UGraphic, UTime; -function TScreenLoading.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenLoading.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; end; @@ -69,7 +70,7 @@ begin Fadeout := false; end; -procedure TScreenLoading.onShow; +procedure TScreenLoading.OnShow; begin inherited; end; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index a4e6009f..7237eb80 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -49,9 +49,9 @@ type TextDescriptionLong: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: widechar; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - procedure onShow; override; + procedure OnShow; override; procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; end; @@ -69,9 +69,10 @@ uses UParty, UDLLManager, UScreenCredits, - USkins; + USkins, + UUnicodeUtils; -function TScreenMain.ParseInput(PressedKey: cardinal; CharCode: widechar; +function TScreenMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; @@ -84,22 +85,19 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': - begin + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; end; - 'C': - begin + Ord('C'): begin if (SDL_ModState = KMOD_LALT) then begin FadeTo(@ScreenCredits, SoundLib.Start); Exit; end; end; - 'M': - begin + Ord('M'): begin if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then begin FadeTo(@ScreenPartyOptions, SoundLib.Start); @@ -107,14 +105,12 @@ begin end; end; - 'S': - begin + Ord('S'): begin FadeTo(@ScreenStatMain, SoundLib.Start); Exit; end; - 'E': - begin + Ord('E'): begin FadeTo(@ScreenEdit, SoundLib.Start); Exit; end; @@ -172,7 +168,11 @@ begin //Editor if Interaction = 3 then begin + {$IFDEF UseMIDIPort} FadeTo(@ScreenEdit, SoundLib.Start); + {$ELSE} + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_EDITOR')); + {$ENDIF} end; //Options @@ -232,7 +232,7 @@ begin Interaction := 0; end; -procedure TScreenMain.onShow; +procedure TScreenMain.OnShow; begin inherited; diff --git a/src/screens/UScreenName.pas b/src/screens/UScreenName.pas index d13db170..42af50d7 100644 --- a/src/screens/UScreenName.pas +++ b/src/screens/UScreenName.pas @@ -47,8 +47,8 @@ type public Goto_SingScreen: boolean; //If true then next Screen in SingScreen constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -59,9 +59,11 @@ uses UGraphic, UIni, UNote, - UTexture; + UTexture, + UUnicodeUtils; -function TScreenName.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; + +function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var I: integer; SDL_ModState: word; @@ -74,10 +76,10 @@ begin + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); // check normal keys - if (IsAlphaNumericChar(CharCode) or - {(CharCode in [' ','-','_','!',',','<','/','*','?','''','"']))} IsPunctuationChar(CharCode)) then + if (IsPrintableChar(CharCode)) then begin - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + + UCS4ToUTF8String(CharCode); Exit; end; @@ -195,7 +197,7 @@ begin SDLK_BACKSPACE: begin - Button[Interaction].Text[0].DeleteLastL; + Button[Interaction].Text[0].DeleteLastLetter(); end; SDLK_ESCAPE : @@ -248,7 +250,7 @@ begin Interaction := 0; end; -procedure TScreenName.onShow; +procedure TScreenName.OnShow; var I: integer; begin diff --git a/src/screens/UScreenOpen.pas b/src/screens/UScreenOpen.pas index a854e81b..70b883c4 100644 --- a/src/screens/UScreenOpen.pas +++ b/src/screens/UScreenOpen.pas @@ -34,10 +34,13 @@ interface {$I switches.inc} uses + Math, + SysUtils, + gl, + SDL, + UPath, UMenu, UMusic, - SDL, - SysUtils, UFiles, UTime, USongs, @@ -46,26 +49,31 @@ uses UTexture, UMenuText, ULyrics, - Math, - gl, UThemes; type TScreenOpen = class(TMenu) private - TextF: array[0..1] of integer; - TextN: integer; - public - Tex_Background: TTexture; - FadeOut: boolean; - Path: string; - BackScreen: pointer; + //fTextF: array[0..1] of integer; + fTextN: integer; // text-box ID of filename + fFilename: IPath; + fBackScreen: PMenu; + procedure AddBox(X, Y, W, H: real); + public constructor Create; override; - procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; -// function Draw: boolean; override; -// procedure Finish; + procedure OnShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + + {** + * Set by the caller to provide a default filename. + * Set to the selected filename after calling this screen or to PATH_NONE + * if the screen was aborted. + * TODO: maybe pass this value with a callback OnValueChanged() + *} + property Filename: IPath READ fFilename WRITE fFilename; + {** The screen that is shown after this screen is closed (set by the caller) *} + property BackScreen: PMenu READ fBackScreen WRITE fBackScreen; end; implementation @@ -75,45 +83,41 @@ uses UDraw, UMain, UScreenEditConvert, - USkins; + USkins, + UUnicodeUtils; -function TScreenOpen.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOpen.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then // Key Down begin // check normal keys - case CharCode of - '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '.', ':', '\': - begin - if Interaction = 0 then - begin - Text[TextN].Text := Text[TextN].Text + CharCode; - end; - end; + if (IsPrintableChar(CharCode)) then + begin + if (Interaction = 0) then + begin + Text[fTextN].Text := Text[fTextN].Text + UCS4ToUTF8String(CharCode); + Exit; + end; end; // check special keys case PressedKey of - SDLK_Q: - begin - Result := false; - end; - 8: // del + SDLK_BACKSPACE: // del begin if Interaction = 0 then begin - Text[TextN].DeleteLastL; + Text[fTextN].DeleteLastLetter; end; end; SDLK_ESCAPE: begin //Empty Filename and go to last Screen - ConversionFileName := ''; + fFileName := PATH_NONE; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end; SDLK_RETURN: @@ -121,16 +125,16 @@ begin if (Interaction = 2) then begin //Update Filename and go to last Screen - ConversionFileName := Text[TextN].Text; + fFileName := Path(Text[fTextN].Text); AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end else if (Interaction = 1) then begin //Empty Filename and go to last Screen - ConversionFileName := ''; + fFileName := PATH_NONE; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(BackScreen); + FadeTo(fBackScreen); end; end; @@ -165,21 +169,25 @@ constructor TScreenOpen.Create; begin inherited Create; + fFilename := PATH_NONE; + // line -{ AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); + { + AddStatic(20, 10, 80, 30, 0, 0, 0, 'MainBar', 'JPG', TEXTURE_TYPE_COLORIZED); AddText(35, 17, 1, 18, 1, 1, 1, 'line'); - TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0');} + TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0'); + } // file list -// AddBox(400, 100, 350, 450); + //AddBox(400, 100, 350, 450); -// TextF[0] := AddText(430, 155, 0, 24, 0, 0, 0, 'a'); -// TextF[1] := AddText(430, 180, 0, 24, 0, 0, 0, 'a'); + //TextF[0] := AddText(430, 155, 0, 24, 0, 0, 0, 'a'); + //TextF[1] := AddText(430, 180, 0, 24, 0, 0, 0, 'a'); // file name AddBox(20, 540, 500, 40); - TextN := AddText(50, 548, 0, 24, 0, 0, 0, ConversionFileName); - AddInteraction(iText, TextN); + fTextN := AddText(50, 548, 0, 24, 0, 0, 0, fFileName.ToUTF8); + AddInteraction(iText, fTextN); // buttons {AddButton(540, 540, 100, 40, Skin.SkinPath + Skin.ButtonF); @@ -196,11 +204,12 @@ begin end; -procedure TScreenOpen.onShow; +procedure TScreenOpen.OnShow; begin inherited; Interaction := 0; + Text[fTextN].Text := fFilename.ToUTF8(); end; (* diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index a6486075..3a046400 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -34,9 +34,9 @@ interface {$I switches.inc} uses - UMenu, SDL, SysUtils, + UMenu, UDisplay, UMusic, UFiles, @@ -48,8 +48,8 @@ type public TextDescription: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure InteractNext; override; procedure InteractPrev; override; procedure InteractNextRow; override; @@ -60,16 +60,17 @@ type implementation uses - UGraphic; + UGraphic, + UUnicodeUtils; -function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -189,7 +190,7 @@ begin Interaction := 0; end; -procedure TScreenOptions.onShow; +procedure TScreenOptions.OnShow; begin inherited; end; diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 0fb8153c..7116ad40 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -34,8 +34,8 @@ interface {$I switches.inc} uses - UMenu, SDL, + UMenu, UDisplay, UMusic, UFiles, @@ -46,24 +46,25 @@ type TScreenOptionsAdvanced = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; end; implementation uses UGraphic, + UUnicodeUtils, SysUtils; -function TScreenOptionsAdvanced.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsAdvanced.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -160,7 +161,7 @@ begin Interaction := 0; end; -procedure TScreenOptionsAdvanced.onShow; +procedure TScreenOptionsAdvanced.OnShow; begin inherited; diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index 0c152c41..caeaad6e 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -35,40 +35,39 @@ interface uses SDL, + UMenu, UDisplay, + UMusic, UFiles, UIni, - UMenu, - UMusic, - USongs, - UThemes; + UThemes, + USongs; type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure RefreshSongs; end; implementation uses - SysUtils, - UGraphic; + UGraphic, + UUnicodeUtils, + SysUtils; -function TScreenOptionsGame.ParseInput(PressedKey: cardinal; - CharCode: WideChar; - PressedDown: boolean): boolean; +function TScreenOptionsGame.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if PressedDown then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -166,7 +165,7 @@ begin ScreenSong.Refresh; end; -procedure TScreenOptionsGame.onShow; +procedure TScreenOptionsGame.OnShow; begin inherited; diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index ba1465b2..8ca13f09 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -46,8 +46,8 @@ type TScreenOptionsGraphics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; end; implementation @@ -55,17 +55,17 @@ implementation uses UGraphic, UMain, - SysUtils, - TypInfo; + UUnicodeUtils, + SysUtils; -function TScreenOptionsGraphics.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsGraphics.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -162,7 +162,7 @@ begin end; -procedure TScreenOptionsGraphics.onShow; +procedure TScreenOptionsGraphics.OnShow; begin inherited; diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 035b0089..0ef4e2a6 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -46,24 +46,25 @@ type TScreenOptionsLyrics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; end; implementation uses UGraphic, + UUnicodeUtils, SysUtils; -function TScreenOptionsLyrics.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsLyrics.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -137,7 +138,7 @@ begin end; -procedure TScreenOptionsLyrics.onShow; +procedure TScreenOptionsLyrics.OnShow; begin inherited; diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 7eb2ced7..828c20f6 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -61,8 +61,8 @@ type PreviewDeviceIndex: integer; // string arrays for select-slide options - InputSourceNames: array of string; - InputDeviceNames: array of string; + InputSourceNames: array of UTF8String; + InputDeviceNames: array of UTF8String; // dynamic generated themes for channel select-sliders SelectSlideChannelTheme: array of TThemeSelectSlide; @@ -95,9 +95,9 @@ type public constructor Create; override; function Draw: boolean; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; - procedure onHide; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure OnHide; override; end; const @@ -126,33 +126,34 @@ uses UFiles, UDisplay, UIni, + UUnicodeUtils, ULog; -function TScreenOptionsRecord.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsRecord.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; end; - '+': + Ord('+'): begin // FIXME: add a nice volume-slider instead // or at least provide visualization and acceleration if the user holds the key pressed. ChangeVolume(0.02); end; - '-': + Ord('-'): begin // FIXME: add a nice volume-slider instead // or at least provide visualization and acceleration if the user holds the key pressed. ChangeVolume(-0.02); end; - 'T': + Ord('T'): begin if ((SDL_GetModState() and KMOD_SHIFT) <> 0) then Ini.ThresholdIndex := (Ini.ThresholdIndex + Length(IThresholdVals) - 1) mod Length(IThresholdVals) @@ -418,7 +419,7 @@ begin NextVolumePollTime := 0; end; -procedure TScreenOptionsRecord.onShow; +procedure TScreenOptionsRecord.OnShow; var ChannelIndex: integer; begin @@ -436,7 +437,7 @@ begin StartPreview(); end; -procedure TScreenOptionsRecord.onHide; +procedure TScreenOptionsRecord.OnHide; var ChannelIndex: integer; begin diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index aa87ceb4..7556dceb 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -34,8 +34,8 @@ interface {$I switches.inc} uses - UMenu, SDL, + UMenu, UDisplay, UMusic, UFiles, @@ -46,26 +46,27 @@ type TScreenOptionsSound = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: widechar; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - procedure onShow; override; + procedure OnShow; override; end; implementation uses UGraphic, + UUnicodeUtils, SysUtils; function TScreenOptionsSound.ParseInput(PressedKey: cardinal; - CharCode: widechar; PressedDown: boolean): boolean; + CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -177,7 +178,7 @@ begin Interaction := 0; end; -procedure TScreenOptionsSound.onShow; +procedure TScreenOptionsSound.OnShow; begin inherited; Interaction := 0; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 1e7407f1..dca581a2 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -49,8 +49,8 @@ type public SkinSelect: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure InteractInc; override; procedure InteractDec; override; end; @@ -61,17 +61,18 @@ uses SysUtils, UGraphic, UMain, - UPath, + UPathUtils, + UUnicodeUtils, USkins; -function TScreenOptionsThemes.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenOptionsThemes.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -135,7 +136,7 @@ begin if (SelInteraction = 0) then begin Skin.OnThemeChange; - UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + UpdateSelectSlideOptions(Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); end; ReloadTheme(); @@ -178,7 +179,7 @@ begin AddButtonText(14, 20, Theme.Options.Description[7]); end; -procedure TScreenOptionsThemes.onShow; +procedure TScreenOptionsThemes.OnShow; begin inherited; @@ -187,7 +188,7 @@ end; procedure TScreenOptionsThemes.ReloadTheme; begin - Theme.LoadTheme(ThemePath + ITheme[Ini.Theme] + '.ini', Ini.Color); + Theme.LoadTheme(ThemePath.Append(ITheme[Ini.Theme] + '.ini'), Ini.Color); ScreenOptionsThemes := TScreenOptionsThemes.create(); ScreenOptionsThemes.onshow; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 03a72fa9..c4295502 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -34,12 +34,12 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UDisplay, UMusic, UFiles, - SysUtils, UThemes; type @@ -99,8 +99,8 @@ type constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -115,16 +115,17 @@ uses UDLLManager, ULanguage, USong, - ULog; + ULog, + UUnicodeUtils; -function TScreenPartyNewRound.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPartyNewRound.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -215,12 +216,12 @@ begin LoadFromTheme(Theme.PartyNewRound); end; -procedure TScreenPartyNewRound.onShow; +procedure TScreenPartyNewRound.OnShow; var I: integer; - function GetTeamPlayers(const Num: byte): string; + function GetTeamPlayers(const Num: byte): UTF8String; var - Players: array of string; + Players: array of UTF8String; J: byte; begin if (Num-1 >= PartySession.Teams.NumTeams) then @@ -229,7 +230,7 @@ var //Create Players array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := string(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + Players[J] := UTF8String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); //Implode and Return Result := Language.Implode(Players); @@ -364,7 +365,7 @@ begin if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[0].Name); + Text[TextNameTeam1].Text := UTF8String(PartySession.Teams.TeamInfo[0].Name); Text[TextTeam1Players].Text := GetTeamPlayers(1); Text[TextScoreTeam1].Visible := true; @@ -385,7 +386,7 @@ begin if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[1].Name); + Text[TextNameTeam2].Text := UTF8String(PartySession.Teams.TeamInfo[1].Name); Text[TextTeam2Players].Text := GetTeamPlayers(2); Text[TextScoreTeam2].Visible := true; @@ -406,7 +407,7 @@ begin if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[2].Name); + Text[TextNameTeam3].Text := UTF8String(PartySession.Teams.TeamInfo[2].Name); Text[TextTeam3Players].Text := GetTeamPlayers(3); Text[TextScoreTeam3].Visible := true; diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 5f7f1d9e..2deffda6 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -61,20 +61,20 @@ type NumPlayer1, NumPlayer2, NumPlayer3: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetPlaylist2; end; var - IPlaylist: array[0..2] of string; - IPlaylist2: array of string; + IPlaylist: array[0..2] of UTF8String; + IPlaylist2: array of UTF8String; const - ITeams: array[0..1] of string = ('2', '3'); - IPlayers: array[0..3] of string = ('1', '2', '3', '4'); - IRounds: array[0..5] of string = ('2', '3', '4', '5', '6', '7'); + ITeams: array[0..1] of UTF8String = ('2', '3'); + IPlayers: array[0..3] of UTF8String = ('1', '2', '3', '4'); + IRounds: array[0..5] of UTF8String = ('2', '3', '4', '5', '6', '7'); implementation @@ -88,9 +88,10 @@ uses USong, UDLLManager, UPlaylist, - USongs; + USongs, + UUnicodeUtils; -function TScreenPartyOptions.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPartyOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var I, J: integer; OnlyMultiPlayer: boolean; @@ -99,8 +100,8 @@ begin if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -239,14 +240,14 @@ begin //Load Screen From Theme LoadFromTheme(Theme.PartyOptions); - SelectLevel := AddSelectSlide (Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); - SelectPlayList := AddSelectSlide (Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); - SelectPlayList2 := AddSelectSlide (Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); - SelectRounds := AddSelectSlide (Theme.PartyOptions.SelectRounds, Rounds, IRounds); - SelectTeams := AddSelectSlide (Theme.PartyOptions.SelectTeams, NumTeams, ITeams); - SelectPlayers1 := AddSelectSlide (Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); - SelectPlayers2 := AddSelectSlide (Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); - SelectPlayers3 := AddSelectSlide (Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); + SelectLevel := AddSelectSlide(Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); + SelectPlayList := AddSelectSlide(Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + SelectPlayList2 := AddSelectSlide(Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); + SelectRounds := AddSelectSlide(Theme.PartyOptions.SelectRounds, Rounds, IRounds); + SelectTeams := AddSelectSlide(Theme.PartyOptions.SelectTeams, NumTeams, ITeams); + SelectPlayers1 := AddSelectSlide(Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); + SelectPlayers2 := AddSelectSlide(Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); + SelectPlayers3 := AddSelectSlide(Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); Interaction := 0; @@ -301,7 +302,7 @@ begin UpdateSelectSlideOptions(Theme.PartyOptions.SelectPlayList2, 2, IPlaylist2, Playlist2); end; -procedure TScreenPartyOptions.onShow; +procedure TScreenPartyOptions.OnShow; begin inherited; diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index c2070fce..887d5202 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -64,8 +64,8 @@ type Player12Name: cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -76,9 +76,10 @@ uses UMain, UIni, UTexture, - UParty; + UParty, + UUnicodeUtils; -function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; I, J: integer; @@ -107,9 +108,14 @@ begin begin // Key Down // check normal keys case CharCode of - '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"': + Ord('0')..Ord('9'), + Ord('a')..Ord('z'), + Ord('A')..Ord('Z'), + Ord(' '), Ord('-'), Ord('_'), Ord('!'), Ord(','), Ord('<'), Ord('/'), + Ord('*'), Ord('?'), Ord(''''), Ord('"'): begin - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + + UCS4ToUTF8String(CharCode); Exit; end; end; @@ -228,7 +234,7 @@ begin SDLK_BACKSPACE: begin - Button[Interaction].Text[0].DeleteLastL; + Button[Interaction].Text[0].DeleteLastLetter; end; SDLK_ESCAPE: @@ -294,7 +300,7 @@ begin Interaction := 0; end; -procedure TScreenPartyPlayer.onShow; +procedure TScreenPartyPlayer.OnShow; var I: integer; begin diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 23cf666d..2de240b8 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -34,11 +34,11 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UDisplay, UMusic, - SysUtils, UThemes; type @@ -69,8 +69,8 @@ type MaxScore: word; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -83,16 +83,17 @@ uses UScreenSingModi, ULanguage, UTexture, - USkins; + USkins, + UUnicodeUtils; -function TScreenPartyScore.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPartyScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -165,7 +166,9 @@ begin DecoColor[0].B := B; //Load Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture)), Theme.PartyScore.DecoTextures.FirstTyp, Color); + Tex := Texture.LoadTexture( + Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.FirstTexture), + Theme.PartyScore.DecoTextures.FirstTyp, Color); DecoTex[0] := Tex.TexNum; //Get Second Color @@ -176,7 +179,9 @@ begin DecoColor[1].B := B; //Load Second Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture)), Theme.PartyScore.DecoTextures.SecondTyp, Color); + Tex := Texture.LoadTexture( + Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.SecondTexture), + Theme.PartyScore.DecoTextures.SecondTyp, Color); DecoTex[1] := Tex.TexNum; //Get Third Color @@ -187,14 +192,16 @@ begin DecoColor[2].B := B; //Load Third Texture - Tex := Texture.LoadTexture(pchar(Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture)), Theme.PartyScore.DecoTextures.ThirdTyp, Color); + Tex := Texture.LoadTexture( + Skin.GetTextureFileName(Theme.PartyScore.DecoTextures.ThirdTexture), + Theme.PartyScore.DecoTextures.ThirdTyp, Color); DecoTex[2] := Tex.TexNum; end; LoadFromTheme(Theme.PartyScore); end; -procedure TScreenPartyScore.onShow; +procedure TScreenPartyScore.OnShow; var I, J: integer; Placings: array [0..5] of byte; @@ -238,7 +245,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); - Text[TextNameTeam1].Text := string(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + Text[TextNameTeam1].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -267,7 +274,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); - Text[TextNameTeam2].Text := string(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + Text[TextNameTeam2].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -296,7 +303,7 @@ begin if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); - Text[TextNameTeam3].Text := string(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + Text[TextNameTeam3].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 3c105c7d..afa5ce83 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -34,10 +34,11 @@ interface {$I switches.inc} uses + SDL, + SysUtils, UMenu, - SDL, UDisplay, + UDisplay, UMusic, - SysUtils, UThemes; type @@ -61,28 +62,29 @@ type TextWinner: cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses +uses UGraphic, UMain, UParty, UScreenSingModi, - ULanguage; + ULanguage, + UUnicodeUtils; -function TScreenPartyWin.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPartyWin.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -135,7 +137,7 @@ begin LoadFromTheme(Theme.PartyWin); end; -procedure TScreenPartyWin.onShow; +procedure TScreenPartyWin.OnShow; var I: integer; Placing: TeamOrderArray; diff --git a/src/screens/UScreenPopup.pas b/src/screens/UScreenPopup.pas index 7e4671d6..fdf4a69c 100644 --- a/src/screens/UScreenPopup.pas +++ b/src/screens/UScreenPopup.pas @@ -34,42 +34,61 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UMusic, UFiles, - SysUtils, UThemes; type + TPopupCheckHandler = procedure(Value: boolean; Data: Pointer); + TScreenPopupCheck = class(TMenu) + private + fHandler: TPopupCheckHandler; + fHandlerData: Pointer; + public - Visible: boolean; //Whether the Menu should be Drawn + Visible: boolean; // whether the menu should be drawn constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; - procedure ShowPopup(msg: string); + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure ShowPopup(const Msg: UTF8String; Handler: TPopupCheckHandler; + HandlerData: Pointer; DefaultValue: boolean = false); function Draw: boolean; override; end; type - TScreenPopupError = class(TMenu) -{ private - CurMenu: byte; //Num of the cur. Shown Menu} + TScreenPopup = class(TMenu) + { + private + CurMenu: byte; //Num of the cur. Shown Menu + } public Visible: boolean; //Whether the Menu should be Drawn constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; - procedure onHide; override; - procedure ShowPopup(msg: string); + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure OnHide; override; + procedure ShowPopup(const Msg: UTF8String); function Draw: boolean; override; end; + TScreenPopupError = class(TScreenPopup) + public + constructor Create; + end; + + TScreenPopupInfo = class(TScreenPopup) + public + constructor Create; + end; + var -// ISelections: array of string; + //ISelections: array of string; SelectValue: integer; implementation @@ -82,70 +101,57 @@ uses ULanguage, UParty, UPlaylist, - UDisplay; + UDisplay, + UUnicodeUtils; -function TScreenPopupCheck.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +{ TScreenPopupCheck } + +function TScreenPopupCheck.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +var + Value: boolean; begin Result := true; if (PressedDown) then begin // Key Down - // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': - begin - Result := false; - Exit; - end; - end; - // check special keys case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin - Display.CheckOK := false; - Display.NextScreenWithCheck := NIL; + Value := false; Visible := false; Result := false; end; SDLK_RETURN: begin - case Interaction of - 0: begin - //Hack to Finish Singscreen correct on Exit with Q Shortcut - if (Display.NextScreenWithCheck = NIL) then - begin - if (Display.CurrentScreen = @ScreenSing) then - ScreenSing.Finish - else if (Display.CurrentScreen = @ScreenSingModi) then - ScreenSingModi.Finish; - end; - - Display.CheckOK := true; - end; - 1: begin - Display.CheckOK := false; - Display.NextScreenWithCheck := NIL; - end; - end; + Value := (Interaction = 0); Visible := false; Result := false; end; - SDLK_DOWN: InteractNext; - SDLK_UP: InteractPrev; - + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: InteractNext; - SDLK_LEFT: InteractPrev; + SDLK_LEFT: InteractPrev; end; end; + + if (not Result) then + begin + if (@fHandler <> nil) then + fHandler(Value, fHandlerData); + end; end; constructor TScreenPopupCheck.Create; begin inherited Create; + fHandler := nil; + fHandlerData := nil; + AddText(Theme.CheckPopup.TextCheck); LoadFromTheme(Theme.CheckPopup); @@ -163,18 +169,24 @@ end; function TScreenPopupCheck.Draw: boolean; begin - Draw:=inherited Draw; + Result := inherited Draw; end; -procedure TScreenPopupCheck.onShow; +procedure TScreenPopupCheck.OnShow; begin inherited; end; -procedure TScreenPopupCheck.ShowPopup(msg: string); +procedure TScreenPopupCheck.ShowPopup(const Msg: UTF8String; Handler: TPopupCheckHandler; + HandlerData: Pointer; DefaultValue: boolean); begin - Interaction := 0; //Reset Interaction + if (DefaultValue) then + Interaction := 0 + else + Interaction := 1; Visible := true; //Set Visible + fHandler := Handler; + fHandlerData := HandlerData; Text[0].Text := Language.Translate(msg); @@ -187,9 +199,9 @@ begin Background.OnShow end; -// error popup +{ TScreenPopup } -function TScreenPopupError.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenPopup.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -223,7 +235,7 @@ begin end; end; -constructor TScreenPopupError.Create; +constructor TScreenPopup.Create; begin inherited Create; @@ -238,22 +250,22 @@ begin Interaction := 0; end; -function TScreenPopupError.Draw: boolean; +function TScreenPopup.Draw: boolean; begin Draw := inherited Draw; end; -procedure TScreenPopupError.onShow; +procedure TScreenPopup.OnShow; begin inherited; end; -procedure TScreenPopupError.onHide; +procedure TScreenPopup.OnHide; begin end; -procedure TScreenPopupError.ShowPopup(msg: string); +procedure TScreenPopup.ShowPopup(const Msg: UTF8String); begin Interaction := 0; //Reset Interaction Visible := true; //Set Visible @@ -277,4 +289,20 @@ begin Button[0].Text[0].Text := 'OK'; end; +{ TScreenPopupError } + +constructor TScreenPopupError.Create; +begin + inherited; + Text[1].Text := Language.Translate('MSG_ERROR_TITLE'); +end; + +{ TScreenPopupInfo } + +constructor TScreenPopupInfo.Create; +begin + inherited; + Text[1].Text := Language.Translate('MSG_INFO_TITLE'); +end; + end. diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index a01c7691..ce1b11e5 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -128,10 +128,10 @@ type TextGolden_ActualValue: array[1..6] of integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; - procedure onShow; override; - procedure onShowFinish; override; + procedure OnShow; override; + procedure OnShowFinish; override; function Draw: boolean; override; procedure FillPlayer(Item, P: integer); @@ -158,16 +158,18 @@ uses UIni, ULog, ULanguage, - UNote; + UNote, + UUnicodeUtils; -function TScreenScore.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; + +function TScreenScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -197,7 +199,7 @@ begin Result := True; if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin //left-click anywhere sends return - ParseInput(SDLK_RETURN, #0, true); + ParseInput(SDLK_RETURN, 0, true); end; end; @@ -261,7 +263,7 @@ begin end; -procedure TScreenScore.onShow; +procedure TScreenScore.OnShow; var P: integer; // player I: integer; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 157f7e64..20805737 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -35,9 +35,9 @@ interface uses SysUtils, - gl, SDL, TextGL, + gl, UFiles, UGraphicClasses, UIni, @@ -49,6 +49,7 @@ uses USongs, UTexture, UThemes, + UPath, UTime; type @@ -101,11 +102,11 @@ type fCurrentVideoPlaybackEngine: IVideoPlayback; constructor Create; override; - procedure onShow; override; - procedure onShowFinish; override; - procedure onHide; override; + procedure OnShow; override; + procedure OnShowFinish; override; + procedure OnHide; override; - function ParseInput(PressedKey: cardinal; CharCode: widechar; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; @@ -127,20 +128,21 @@ uses UNote, URecord, USong, - UDisplay; + UDisplay, + UUnicodeUtils; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: widechar; +function TScreenSing.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // key down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin // when not ask before exit then finish now if (Ini.AskbeforeDel <> 1) then @@ -152,7 +154,7 @@ begin Result := false; Exit; end; - 'V': // show visualization + Ord('V'): // show visualization begin fShowVisualization := not fShowVisualization; @@ -166,7 +168,7 @@ begin Exit; end; - 'P': + Ord('P'): begin Pause; Exit; @@ -216,6 +218,8 @@ end; // pause mod procedure TScreenSing.Pause; +var + VideoFile: IPath; begin if (not Paused) then // enable pause begin @@ -228,8 +232,8 @@ begin AudioPlayback.Pause; // pause video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + - CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.Exists then fCurrentVideoPlaybackEngine.Pause; end @@ -241,8 +245,8 @@ begin AudioPlayback.Play; // video - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + - CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.Exists then fCurrentVideoPlaybackEngine.Pause; Paused := false; @@ -307,7 +311,7 @@ begin LyricsSync := TLyricsSyncSource.Create(); end; -procedure TScreenSing.onShow; +procedure TScreenSing.OnShow; var Index: integer; V1: boolean; @@ -317,12 +321,12 @@ var V2M: boolean; V3R: boolean; Color: TRGB; - + VideoFile, BgFile: IPath; success: boolean; begin inherited; - Log.LogStatus('Begin', 'onShow'); + Log.LogStatus('Begin', 'OnShow'); FadeOut := false; // reset video playback engine, to play video clip ... @@ -423,7 +427,7 @@ begin // FIXME: bad style, put the try-except into loadsong() and not here try // check if file is xml - if copy(CurrentSong.FileName, length(CurrentSong.FileName) - 3, 4) = '.xml' then + if CurrentSong.FileName.GetExtension.ToUTF8 = '.xml' then success := CurrentSong.LoadXMLSong() else success := CurrentSong.LoadSong(); @@ -467,9 +471,10 @@ begin *} VideoLoaded := false; fShowVisualization := false; - if (CurrentSong.Video <> '') and FileExists(CurrentSong.Path + CurrentSong.Video) then + VideoFile := CurrentSong.Path.Append(CurrentSong.Video); + if (CurrentSong.Video.IsSet) and VideoFile.IsFile then begin - if (fCurrentVideoPlaybackEngine.Open(CurrentSong.Path + CurrentSong.Video)) then + if (fCurrentVideoPlaybackEngine.Open(VideoFile)) then begin fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -482,15 +487,17 @@ begin {* * set background to: picture *} - if (CurrentSong.Background <> '') and (VideoLoaded = false) + if (CurrentSong.Background.IsSet) and (VideoLoaded = false) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then + begin + BgFile := CurrentSong.Path.Append(CurrentSong.Background); try - Tex_Background := Texture.LoadTexture(CurrentSong.Path + CurrentSong.Background); + Tex_Background := Texture.LoadTexture(BgFile); except - Log.LogError('Background could not be loaded: ' + CurrentSong.Path + - CurrentSong.Background); + Log.LogError('Background could not be loaded: ' + BgFile.ToNative); Tex_Background.TexNum := 0; end + end else begin Tex_Background.TexNum := 0; @@ -622,7 +629,7 @@ begin if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); - Log.LogStatus('End', 'onShow'); + Log.LogStatus('End', 'OnShow'); end; procedure TScreenSing.onShowFinish; @@ -640,7 +647,7 @@ begin CountSkipTimeSet; end; -procedure TScreenSing.onHide; +procedure TScreenSing.OnHide; begin // background texture if (Tex_Background.TexNum > 0) then diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas index eeb06004..48d1e9a1 100644 --- a/src/screens/UScreenSingModi.pas +++ b/src/screens/UScreenSingModi.pas @@ -47,7 +47,7 @@ uses ULyrics, TextGL, gl, - + UPath, UThemes, UScreenSing, ModiSDK; @@ -62,16 +62,16 @@ type TeamInfo: TTeamInfo; constructor Create; override; - procedure onShow; override; + procedure OnShow; override; //procedure onShowFinish; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; procedure Finish; override; end; type TCustomSoundEntry = record - Filename : string; + Filename : IPath; Stream : TAudioPlaybackStream; end; @@ -108,13 +108,13 @@ uses UGraphicClasses, ULanguage, UNote, - UPath, + UPathUtils, URecord, USkins; // Method for input parsing. If false is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -176,7 +176,7 @@ begin end; end; -procedure TScreenSingModi.onShow; +procedure TScreenSingModi.OnShow; var I: integer; begin @@ -503,19 +503,20 @@ end; function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; var - Texname, EXT: string; + TexName: IPath; + Ext: UTF8String; Tex: TTexture; begin //Get texture Name TexName := Skin.GetTextureFileName(string(Name)); //Get File Typ - Ext := ExtractFileExt(TexName); - if (uppercase(Ext) = '.JPG') then + Ext := TexName.GetExtension().ToUTF8; + if (UpperCase(Ext) = '.JPG') then Ext := 'JPG' else Ext := 'BMP'; - Tex := Texture.LoadTexture(false, PChar(TexName), UTEXTURE.TTextureType(Typ), 0); + Tex := Texture.LoadTexture(false, TexName, UTexture.TTextureType(Typ), 0); Result.TexNum := Tex.TexNum; Result.W := Tex.W; @@ -544,20 +545,21 @@ function LoadSound(const Name: PChar): cardinal; var Stream: TAudioPlaybackStream; i: integer; - Filename: string; + Filename: IPath; + SoundFile: IPath; begin //Search for Sound in already loaded Sounds - Filename := UpperCase(SoundPath + Name); + SoundFile := SoundPath.Append(Name); for i := 0 to High(CustomSounds) do begin - if (UpperCase(CustomSounds[i].Filename) = Filename) then + if (SoundFile.Equals(CustomSounds[i].Filename, true)) then begin Result := i; Exit; end; end; - Stream := AudioPlayback.OpenSound(SoundPath + string(Name)); + Stream := AudioPlayback.OpenSound(SoundFile); if (Stream = nil) then begin Result := 0; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index fa3c836e..5fa6de39 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -38,6 +38,7 @@ uses SDL, UCommon, UDisplay, + UPath, UFiles, UIni, ULanguage, @@ -118,19 +119,19 @@ type procedure SetScroll4; procedure SetScroll5; procedure SetScroll6; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); - procedure onShow; override; - procedure onHide; override; + procedure OnShow; override; + procedure OnHide; override; procedure SelectNext; procedure SelectPrev; 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 ShowCatTLCustom(Caption: UTF8String);// Show Custom Text in Top left procedure HideCatTL;// Show Cat in Tob left procedure Refresh; //Refresh Song Sorting procedure ChangeMusic; @@ -164,7 +165,8 @@ uses UParty, UPlaylist, UScreenSongMenu, - USkins; + USkins, + UUnicodeUtils; // ***** Public methods ****** // @@ -211,7 +213,7 @@ begin end; //Show Wrong Song when Tabs on Fix End -procedure TScreenSong.ShowCatTLCustom(Caption: string);// Show Custom Text in Top left +procedure TScreenSong.ShowCatTLCustom(Caption: UTF8String);// Show Custom Text in Top left begin Text[TextCat].Text := Caption; Text[TextCat].Visible := true; @@ -243,12 +245,13 @@ 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; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var I: integer; I2: integer; SDL_ModState: word; - Letter: WideChar; + UpperLetter: UCS4Char; + TempStr: UTF8String; begin Result := true; @@ -273,9 +276,10 @@ begin //Jump to Artist/Titel if ((SDL_ModState and KMOD_LALT <> 0) and (Mode = smNormal)) then begin - if (WideCharUpperCase(CharCode)[1] in ([WideChar('A')..WideChar('Z'), WideChar('0') .. WideChar('9')]) ) then + UpperLetter := UCS4UpperCase(CharCode); + + if (UpperLetter in ([Ord('A')..Ord('Z'), Ord('0') .. Ord('9')]) ) then begin - Letter := WideCharUpperCase(CharCode)[1]; I2 := Length(CatSongs.Song); //Jump To Titel @@ -283,18 +287,21 @@ begin begin for I := 1 to High(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) and - (Length(CatSongs.Song[(I + Interaction) mod I2].Title)>0) and - (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Title)[1] = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + TempStr := CatSongs.Song[(I + Interaction) mod I2].Title; + if (Length(TempStr) > 0) and + (UCS4UpperCase(UTF8ToUCS4String(TempStr)[0]) = UpperLetter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlaySound(SoundLib.Change); + AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll4; - //Break and Exit - Exit; + ChangeMusic; + SetScroll4; + //Break and Exit + Exit; + end; end; end; end @@ -303,19 +310,22 @@ begin begin for I := 1 to High(CatSongs.Song) do begin - if (CatSongs.Song[(I + Interaction) mod I2].Visible) and - (Length(CatSongs.Song[(I + Interaction) mod I2].Artist)>0) and - (WideStringUpperCase(CatSongs.Song[(I + Interaction) mod I2].Artist)[1] = Letter) then + if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin - SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); + TempStr := CatSongs.Song[(I + Interaction) mod I2].Artist; + if (Length(TempStr) > 0) and + (UCS4UpperCase(UTF8ToUCS4String(TempStr)[0]) = UpperLetter) then + begin + SkipTo(CatSongs.VisibleIndex((I + Interaction) mod I2)); - AudioPlayback.PlaySound(SoundLib.Change); + AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - SetScroll4; + ChangeMusic; + SetScroll4; - //Break and Exit - Exit; + //Break and Exit + Exit; + end; end; end; end; @@ -325,14 +335,14 @@ begin end; // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; end; - 'M': //Show SongMenu + Ord('M'): //Show SongMenu begin if (Songs.SongList.Count > 0) then begin @@ -342,41 +352,41 @@ begin begin if CatSongs.CatNumShow = -3 then begin - ScreenSongMenu.onShow; + ScreenSongMenu.OnShow; ScreenSongMenu.MenuShow(SM_Playlist); end else begin - ScreenSongMenu.onShow; + ScreenSongMenu.OnShow; ScreenSongMenu.MenuShow(SM_Main); end; end else begin - ScreenSongMenu.onShow; + ScreenSongMenu.OnShow; ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end //Party Mode -> Show Party Menu else begin - ScreenSongMenu.onShow; + ScreenSongMenu.OnShow; ScreenSongMenu.MenuShow(SM_Party_Main); end; end; Exit; end; - 'P': //Show Playlist Menu + Ord('P'): //Show Playlist Menu begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - ScreenSongMenu.onShow; + ScreenSongMenu.OnShow; ScreenSongMenu.MenuShow(SM_Playlist_Load); end; Exit; end; - 'J': //Show Jumpto Menu + Ord('J'): //Show Jumpto Menu begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin @@ -385,13 +395,13 @@ begin Exit; end; - 'E': + Ord('E'): begin OpenEditor; Exit; end; - 'R': + Ord('R'): begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then @@ -515,7 +525,7 @@ begin if (CatSongs.CatNumShow < -1) then begin //Atm: Set Empty Filter - CatSongs.SetFilter('', 0); + CatSongs.SetFilter('', fltAll); //Show Cat in Top Left Mod HideCatTL; @@ -744,18 +754,18 @@ begin if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, #0, true); + Result:=ParseInput(SDLK_ESCAPE, 0, true); //song scrolling with mousewheel if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then - ParseInput(SDLK_RIGHT, #0, true); + ParseInput(SDLK_RIGHT, 0, true); if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then - ParseInput(SDLK_LEFT, #0, true); + ParseInput(SDLK_LEFT, 0, true); //LMB anywhere starts if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - ParseInput(SDLK_RETURN, #0, true); + ParseInput(SDLK_RETURN, 0, true); end; constructor TScreenSong.Create; @@ -833,9 +843,9 @@ var I: integer; CoverButtonIndex: integer; CoverButton: TButton; - CoverName: string; CoverTexture: TTexture; Cover: TCover; + CoverFile: IPath; Song: TSong; begin if (Length(CatSongs.Song) <= 0) then @@ -850,7 +860,7 @@ begin CoverButton := nil; // create a clickable cover - CoverButtonIndex := AddButton(300 + I*250, 140, 200, 200, '', TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections); + CoverButtonIndex := AddButton(300 + I*250, 140, 200, 200, PATH_NONE, TEXTURE_TYPE_PLAIN, Theme.Song.Cover.Reflections); if (CoverButtonIndex > -1) then CoverButton := Button[CoverButtonIndex]; if (CoverButton = nil) then @@ -859,18 +869,16 @@ begin Song := CatSongs.Song[I]; // if cover-image is not found then show 'no cover' - if (not FileExists(Song.Path + Song.Cover)) then - Song.Cover := ''; - - if (Song.Cover = '') then - CoverName := Skin.GetTextureFileName('SongCover') - else - CoverName := Song.Path + Song.Cover; + CoverFile := Song.Path.Append(Song.Cover); + if (not CoverFile.IsFile()) then + Song.Cover := PATH_NONE; + if (Song.Cover.IsUnset) then + CoverFile := Skin.GetTextureFileName('SongCover'); // load cover and cache its texture - Cover := Covers.FindCover(CoverName); + Cover := Covers.FindCover(CoverFile); if (Cover = nil) then - Cover := Covers.AddCover(CoverName); + Cover := Covers.AddCover(CoverFile); // use the cached texture // TODO: this is a workaround until the new song-loading works. @@ -910,7 +918,7 @@ begin end; // Set visibility of video icon - Static[VideoIcon].Visible := (CatSongs.Song[Interaction].Video <> ''); + Static[VideoIcon].Visible := CatSongs.Song[Interaction].Video.IsSet; // Set texts Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; @@ -1399,7 +1407,7 @@ begin end; end; -procedure TScreenSong.onShow; +procedure TScreenSong.OnShow; begin inherited; {** @@ -1456,14 +1464,14 @@ begin SetStatics; end; -procedure TScreenSong.onHide; +procedure TScreenSong.OnHide; begin // turn music volume to 100% AudioPlayback.SetVolume(1.0); // if preview is deactivated: load musicfile now if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); + AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); // if hide then stop music (for party mode popup on exit) if (Display.NextScreen <> @ScreenSing) and @@ -1642,7 +1650,7 @@ begin if not assigned(Song) then Exit; - if AudioPlayback.Open(Song.Path + Song.Mp3) then + if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then begin AudioPlayback.Position := AudioPlayback.Length / 4; // set preview volume diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index e55a6276..3a199576 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -34,42 +34,39 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UDisplay, UMusic, UFiles, - SysUtils, + USongs, UThemes; type TScreenSongJumpto = class(TMenu) private //For ChangeMusic - LastPlayed: integer; - VisibleBool: boolean; - public - VisSongs: integer; + fLastPlayed: integer; + fVisible: boolean; + fSelectType: TSongFilter; + fVisSongs: integer; - constructor Create; override; + procedure SetTextFound(Count: Cardinal); //Visible //Whether the Menu should be Drawn //Whether the Menu should be Drawn procedure SetVisible(Value: boolean); - property Visible: boolean read VisibleBool write SetVisible; + public + constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; function Draw: boolean; override; - procedure SetTextFound(const Count: cardinal); + property Visible: boolean read fVisible write SetVisible; end; -var - IType: array [0..2] of string; - SelectType: integer; - - implementation uses @@ -79,26 +76,24 @@ uses UTexture, ULanguage, UParty, - USongs, UScreenSong, - ULog; + ULog, + UUnicodeUtils; -function TScreenSongJumpto.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenSongJumpto.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case CharCode of - '0'..'9', 'a'..'z', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"', - '[', '{', ';', ':': - begin - if Interaction = 0 then - begin - Button[0].Text[0].Text := Button[0].Text[0].Text + CharCode; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); - end; - end; + if (IsAlphaNumericChar(CharCode) or + IsPunctuationChar(CharCode)) then + begin + if (Interaction = 0) then + begin + Button[0].Text[0].Text := Button[0].Text[0].Text + UCS4ToUTF8String(CharCode); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); + end; end; // check special keys @@ -107,8 +102,8 @@ begin begin if (Interaction = 0) and (Length(Button[0].Text[0].Text) > 0) then begin - Button[0].Text[0].DeleteLastL; - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + Button[0].Text[0].DeleteLastLetter(); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); end; end; @@ -117,18 +112,15 @@ begin begin Visible := false; AudioPlayback.PlaySound(SoundLib.Back); - if (VisSongs = 0) and (Length(Button[0].Text[0].Text) > 0) then + if (fVisSongs = 0) and (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; - CatSongs.SetFilter('', 0); + CatSongs.SetFilter('', fltAll); SetTextFound(0); end; end; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times SDLK_DOWN: begin {SelectNext; @@ -146,7 +138,7 @@ begin Interaction := 1; InteractInc; if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); Interaction := 0; end; SDLK_LEFT: @@ -154,7 +146,7 @@ begin Interaction := 1; InteractDec; if (Length(Button[0].Text[0].Text) > 0) then - SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, SelectType)); + SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); Interaction := 0; end; end; @@ -162,8 +154,6 @@ begin end; constructor TScreenSongJumpto.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; @@ -175,23 +165,23 @@ begin if (Length(Button[0].Text) = 0) then AddButtonText(14, 20, ''); - SelectType := 0; - AddSelectSlide(Theme.SongJumpto.SelectSlideType, SelectType, Theme.SongJumpto.IType); + fSelectType := fltAll; + AddSelectSlide(Theme.SongJumpto.SelectSlideType, PInteger(@fSelectType)^, Theme.SongJumpto.IType); Interaction := 0; - LastPlayed := 0; + fLastPlayed := 0; end; procedure TScreenSongJumpto.SetVisible(Value: boolean); begin -//If change from unvisible to Visible then OnShow - if (VisibleBool = false) and (Value = true) then +//If change from invisible to Visible then OnShow + if (fVisible = false) and (Value = true) then OnShow; - VisibleBool := Value; + fVisible := Value; end; -procedure TScreenSongJumpto.onShow; +procedure TScreenSongJumpto.OnShow; begin inherited; @@ -208,7 +198,7 @@ begin Interaction := 0; Button[0].Text[0].Selected := true; - LastPlayed := ScreenSong.Interaction; + fLastPlayed := ScreenSong.Interaction; end; function TScreenSongJumpto.Draw: boolean; @@ -216,7 +206,7 @@ begin Result := inherited Draw; end; -procedure TScreenSongJumpto.SetTextFound(const Count: cardinal); +procedure TScreenSongJumpto.SetTextFound(Count: cardinal); begin if (Count = 0) then begin @@ -235,7 +225,7 @@ begin end; //Set visSongs - VisSongs := Count; + fVisSongs := Count; //Fix SongSelection ScreenSong.Interaction := high(CatSongs.Song); @@ -243,9 +233,9 @@ begin ScreenSong.FixSelected; //Play Correct Music - if (ScreenSong.Interaction <> LastPlayed) then + if (ScreenSong.Interaction <> fLastPlayed) then begin - LastPlayed := ScreenSong.Interaction; + fLastPlayed := ScreenSong.Interaction; ScreenSong.ChangeMusic; end; diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index 0af94a8f..ec893c7a 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -50,8 +50,8 @@ type Visible: boolean; // whether the menu should be drawn constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; function Draw: boolean; override; procedure MenuShow(sMenu: byte); procedure HandleReturn; @@ -73,7 +73,7 @@ const SM_Party_Joker = 128 or 2; var - ISelections: array of string; + ISelections: array of UTF8String; SelectValue: integer; implementation @@ -86,9 +86,10 @@ uses ULanguage, UParty, UPlaylist, - USongs; + USongs, + UUnicodeUtils; -function TScreenSongMenu.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenSongMenu.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -96,27 +97,29 @@ begin if (CurMenu = SM_Playlist_New) and (Interaction=0) then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of - '0'..'9', 'A'..'Z', ' ', '-', '_', '!', ',', '<', '/', '*', '?', '''', '"': - begin - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + CharCode; - exit; - end; + if IsAlphaNumericChar(CharCode) or + (CharCode in [Ord(' '), Ord('-'), Ord('_'), Ord('!'), + Ord(','), Ord('<'), Ord('/'), Ord('*'), + Ord('?'), Ord(''''), Ord('"')]) then + begin + Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + + UCS4ToUTF8String(CharCode); + exit; end; // check special keys case PressedKey of SDLK_BACKSPACE: begin - Button[Interaction].Text[0].DeleteLastL; + Button[Interaction].Text[0].DeleteLastLetter; exit; end; end; end; // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -223,7 +226,7 @@ begin Result := inherited Draw; end; -procedure TScreenSongMenu.onShow; +procedure TScreenSongMenu.OnShow; begin inherited; end; @@ -405,9 +408,9 @@ begin 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[0].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[2].Name); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); // set right interaction diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index bbbb4a1b..249626b0 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -55,8 +55,8 @@ type TotPages: cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetTitle; @@ -66,20 +66,21 @@ type implementation uses - UGraphic, - ULanguage, Math, Classes, - ULog; + UGraphic, + ULanguage, + ULog, + UUnicodeUtils; -function TScreenStatDetail.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenStatDetail.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -178,7 +179,7 @@ begin Typ := TStatType(0); end; -procedure TScreenStatDetail.onShow; +procedure TScreenStatDetail.OnShow; begin inherited; diff --git a/src/screens/UScreenStatMain.pas b/src/screens/UScreenStatMain.pas index 2fd91288..204f40cd 100644 --- a/src/screens/UScreenStatMain.pas +++ b/src/screens/UScreenStatMain.pas @@ -47,14 +47,14 @@ type private //Some Stat Value that don't need to be calculated 2 times SongsWithVid: cardinal; - function FormatOverviewIntro(FormatStr: string): string; - function FormatSongOverview(FormatStr: string): string; - function FormatPlayerOverview(FormatStr: string): string; + function FormatOverviewIntro(FormatStr: UTF8String): UTF8String; + function FormatSongOverview(FormatStr: UTF8String): UTF8String; + function FormatPlayerOverview(FormatStr: UTF8String): UTF8String; public TextOverview: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; - procedure onShow; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetOverview; @@ -70,21 +70,17 @@ uses ULanguage, UCommon, Classes, - {$IFDEF win32} - windows, - {$ELSE} - sysconst, - {$ENDIF} - ULog; - -function TScreenStatMain.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; + ULog, + UUnicodeUtils; + +function TScreenStatMain.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then begin // Key Down // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -170,11 +166,11 @@ begin //Set Songs with Vid SongsWithVid := 0; for I := 0 to Songs.SongList.Count -1 do - if (TSong(Songs.SongList[I]).Video <> '') then + if (TSong(Songs.SongList[I]).Video.IsSet) then Inc(SongsWithVid); end; -procedure TScreenStatMain.onShow; +procedure TScreenStatMain.OnShow; begin inherited; @@ -182,7 +178,7 @@ begin SetOverview; end; -function TScreenStatMain.FormatOverviewIntro(FormatStr: string): string; +function TScreenStatMain.FormatOverviewIntro(FormatStr: UTF8String): UTF8String; var Year, Month, Day: word; begin @@ -203,10 +199,10 @@ begin end; end; -function TScreenStatMain.FormatSongOverview(FormatStr: string): string; +function TScreenStatMain.FormatSongOverview(FormatStr: UTF8String): UTF8String; var CntSongs, CntSungSongs, CntVidSongs: integer; - MostPopSongArtist, MostPopSongTitle: string; + MostPopSongArtist, MostPopSongTitle: UTF8String; StatList: TList; MostSungSong: TStatResultMostSungSong; begin @@ -247,12 +243,12 @@ begin end; end; -function TScreenStatMain.FormatPlayerOverview(FormatStr: string): string; +function TScreenStatMain.FormatPlayerOverview(FormatStr: UTF8String): UTF8String; var CntPlayers: integer; BestScoreStat: TStatResultBestScores; BestSingerStat: TStatResultBestSingers; - BestPlayer, BestScorePlayer: string; + BestPlayer, BestScorePlayer: UTF8String; BestPlayerScore, BestScore: integer; SingerStats, ScoreStats: TList; begin @@ -307,7 +303,7 @@ end; procedure TScreenStatMain.SetOverview; var - Overview: string; + Overview: UTF8String; begin // Format overview Overview := FormatOverviewIntro(Language.Translate('STAT_OVERVIEW_INTRO')) + '\n \n' + diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 1013a9b5..f9c86643 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -56,9 +56,9 @@ type Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; - procedure onShow; override; + procedure OnShow; override; function Draw: boolean; override; end; @@ -67,19 +67,19 @@ implementation uses UDataBase, UGraphic, + UMain, UIni, - UNote; + UNote, + UUnicodeUtils; -function TScreenTop5.ParseInput(PressedKey: cardinal; - CharCode: WideChar; - PressedDown: boolean): boolean; +function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if PressedDown then begin // check normal keys - case WideCharUpperCase(CharCode)[1] of - 'Q': + case UCS4UpperCase(CharCode) of + Ord('Q'): begin Result := false; Exit; @@ -113,7 +113,7 @@ begin Result := true; if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then //left-click anywhere sends return - ParseInput(SDLK_RETURN, #0, true); + ParseInput(SDLK_RETURN, 0, true); end; constructor TScreenTop5.Create; @@ -137,7 +137,7 @@ begin end; -procedure TScreenTop5.onShow; +procedure TScreenTop5.OnShow; var I: integer; PMax: integer; diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas index a00a84e2..4b463613 100644 --- a/src/screens/UScreenWelcome.pas +++ b/src/screens/UScreenWelcome.pas @@ -45,9 +45,9 @@ type Animation: real; Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function Draw: boolean; override; - procedure onShow; override; + procedure OnShow; override; end; implementation @@ -58,7 +58,7 @@ uses USkins, UTexture; -function TScreenWelcome.ParseInput(PressedKey: cardinal; CharCode: WideChar; PressedDown: boolean): boolean; +function TScreenWelcome.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; if (PressedDown) then @@ -91,7 +91,7 @@ begin Fadeout := false; end; -procedure TScreenWelcome.onShow; +procedure TScreenWelcome.OnShow; begin inherited; -- cgit v1.2.3 From 85c7cf68848e3640238cfaa631305ae87e59cf66 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 9 Nov 2009 21:00:17 +0000 Subject: fixed folders=on bug for the moment git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1941 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 5fa6de39..9a534c51 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -868,10 +868,17 @@ begin Song := CatSongs.Song[I]; - // if cover-image is not found then show 'no cover' - CoverFile := Song.Path.Append(Song.Cover); - if (not CoverFile.IsFile()) then + if not Song.Main then + begin // to-do : load category covers again... + // just a workaround to fic folders=on for the moment... + // if cover-image is not found then show 'no cover' + CoverFile := Song.Path.Append(Song.Cover); + if (not CoverFile.IsFile()) then + Song.Cover := PATH_NONE; + end + else Song.Cover := PATH_NONE; + if (Song.Cover.IsUnset) then CoverFile := Skin.GetTextureFileName('SongCover'); -- cgit v1.2.3 From ec75bc2b03e707c479f3605ffc1a8d9fe38c165b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Nov 2009 15:25:54 +0000 Subject: header tags that are not supported are written to the end of the songheader when saving in editor fixed header reader ending in infinite loop when there is a header line w/o Colon git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1943 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 00e62c16..04407005 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1296,7 +1296,12 @@ begin if FileExt.ToUTF8 = '.xml' then Error := not CurrentSong.LoadXMLSong() else - Error := not CurrentSong.LoadSong(); + begin + // reread header with custom tags + Error := not CurrentSong.Analyse(true); + if not Error then + Error := not CurrentSong.LoadSong; + end; except Error := true; end; -- cgit v1.2.3 From 1c86cfca45351b172e42d508cb55788c644ed392 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 17 Nov 2009 18:50:57 +0000 Subject: fixed #89: wrong mp3 playback when selecting song while scrolling the issue was caused by the delayed song loading to prevent noise when scrolling git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1947 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 9a534c51..ff2ab201 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -57,6 +57,9 @@ type private Equalizer: Tms_Equalizer; + PreviewOpened: Integer; // interaction of the Song that is loaded for preview music + // -1 if nothing is opened + procedure StartMusicPreview(); procedure StopMusicPreview(); public @@ -834,6 +837,8 @@ begin Equalizer := Tms_Equalizer.Create(AudioPlayback, Theme.Song.Equalizer); + PreviewOpened := -1; + if (Length(CatSongs.Song) > 0) then Interaction := 0; end; @@ -1440,7 +1445,9 @@ begin begin //Load Music only when Song Preview is activated if ( Ini.PreviewVolume <> 0 ) then - StartMusicPreview(); + StartMusicPreview() + else + PreviewOpened := -1; SetScroll; end; @@ -1473,13 +1480,13 @@ end; procedure TScreenSong.OnHide; begin + // if preview is not loaded: load musicfile now + if (PreviewOpened <> Interaction) then + AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); + // turn music volume to 100% AudioPlayback.SetVolume(1.0); - // if preview is deactivated: load musicfile now - if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); - // if hide then stop music (for party mode popup on exit) if (Display.NextScreen <> @ScreenSing) and (Display.NextScreen <> @ScreenSingModi) then @@ -1659,6 +1666,8 @@ begin if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then begin + PreviewOpened := Interaction; + AudioPlayback.Position := AudioPlayback.Length / 4; // set preview volume if (Ini.PreviewFading = 0) then @@ -1706,6 +1715,7 @@ end; procedure TScreenSong.ChangeMusic; begin StopMusicPreview(); + PreviewOpened := -1; // Preview song if activated and current selection is not a category cover if (CatSongs.VisibleSongs > 0) and -- cgit v1.2.3 From 9975f56cded5f6251d0110238fd97b7ee7ccae31 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 18 Nov 2009 14:42:34 +0000 Subject: some changes on mousesupport - you can click on the whole area of a button after fading - options on selects can be changed by clicking on the arrows - fix mouse parsing at the screensong extensions git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1950 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index ff2ab201..e74ea75d 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -755,20 +755,33 @@ function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: in begin Result := true; - if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then - //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, 0, true); + if (ScreenSongMenu.Visible) then + begin + Result := ScreenSongMenu.ParseMouse(MouseButton, BtnDown, X, Y); + exit; + end + else if (ScreenSongJumpTo.Visible) then + begin + Result := ScreenSongJumpTo.ParseMouse(MouseButton, BtnDown, X, Y); + exit; + end + else // no extension visible + begin + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then + //if RightMbESC is set, send ESC keypress + Result:=ParseInput(SDLK_ESCAPE, 0, true); - //song scrolling with mousewheel - if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then - ParseInput(SDLK_RIGHT, 0, true); + //song scrolling with mousewheel + if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then + ParseInput(SDLK_RIGHT, 0, true); - if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then - ParseInput(SDLK_LEFT, 0, true); + if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then + ParseInput(SDLK_LEFT, 0, true); - //LMB anywhere starts - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - ParseInput(SDLK_RETURN, 0, true); + //LMB anywhere starts + if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then + ParseInput(SDLK_RETURN, 0, true); + end; end; constructor TScreenSong.Create; -- cgit v1.2.3 From 91bb1d1517faa4b1abe25d2e0adc7cbaecb6b84d Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 18 Nov 2009 16:04:42 +0000 Subject: select songs by clicking on them click on front song starts singing git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1952 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 77 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 10 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index e74ea75d..a9c47401 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -752,6 +752,9 @@ begin end; function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; + var + I, J: Integer; + Btn: Integer; begin Result := true; @@ -767,20 +770,74 @@ begin end else // no extension visible begin - if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then + if (BtnDown) then + begin //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, 0, true); + if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) then + Result:=ParseInput(SDLK_ESCAPE, 0, true) + + //song scrolling with mousewheel + else if (MouseButton = SDL_BUTTON_WHEELDOWN) then + ParseInput(SDLK_RIGHT, 0, true) + + else if (MouseButton = SDL_BUTTON_WHEELUP) then + ParseInput(SDLK_LEFT, 0, true) + + //LMB anywhere starts + else if (MouseButton = SDL_BUTTON_LEFT) then + begin + if (CatSongs.VisibleSongs > 4) then + begin + // select the second visible button left from selected + I := 0; + Btn := Interaction; + while (I < 2) do + begin + Dec(Btn); + if (Btn < 0) then + Btn := High(CatSongs.Song); + + if (CatSongs.Song[Btn].Visible) then + Inc(I); + end; - //song scrolling with mousewheel - if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then - ParseInput(SDLK_RIGHT, 0, true); + // test the 5 front buttons for click + for I := 0 to 4 do + begin + if InRegion(X, Y, Button[Btn].GetMouseOverArea) then + begin + // song cover clicked + if (I = 2) then + begin // Selected Song clicked -> start singing + ParseInput(SDLK_RETURN, 0, true); + end + else + begin // one of the other 4 covers in the front clicked -> select it + J := I - 2; + while (J < 0) do + begin + ParseInput(SDLK_LEFT, 0, true); + Inc(J); + end; - if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then - ParseInput(SDLK_LEFT, 0, true); + while (J > 0) do + begin + ParseInput(SDLK_RIGHT, 0, true); + Dec(J); + end; + end; + Break; + end; - //LMB anywhere starts - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - ParseInput(SDLK_RETURN, 0, true); + Btn := CatSongs.FindNextVisible(Btn); + if (Btn = -1) then + Break; + end; + end + else + ParseInput(SDLK_RETURN, 0, true); + end; + end; end; end; -- cgit v1.2.3 From cd5c858d00c6cbc27291523e2c78d28575778c9e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Nov 2009 17:55:34 +0000 Subject: fixed assembla #92: all song covers look like selected ones git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1958 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a9c47401..7cfb0b0a 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -908,9 +908,6 @@ begin Equalizer := Tms_Equalizer.Create(AudioPlayback, Theme.Song.Equalizer); PreviewOpened := -1; - - if (Length(CatSongs.Song) > 0) then - Interaction := 0; end; procedure TScreenSong.GenerateThumbnails(); @@ -973,10 +970,17 @@ begin CoverTexture := Cover.GetPreviewTexture(); Texture.AddTexture(CoverTexture, TEXTURE_TYPE_PLAIN, true); CoverButton.Texture := CoverTexture; + + // set selected to false -> the right texture will be displayed + CoverButton.Selected := False; end; Cover.Free; end; + + // reset selection + if (Length(CatSongs.Song) > 0) then + Interaction := 0; end; procedure TScreenSong.SetScroll; -- cgit v1.2.3 From 735a5b67345e2888de89d89b4f31b4d48c06f9ec Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 24 Nov 2009 20:04:01 +0000 Subject: use second players color to indicate selected note in editor git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1960 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 04407005..609a689b 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -503,11 +503,11 @@ begin // right if SDL_ModState = 0 then begin - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; end; @@ -558,11 +558,11 @@ begin // left if SDL_ModState = 0 then begin - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Dec(CurrentNote); if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; end; @@ -623,12 +623,12 @@ begin PlaySentenceMidi := false; {$ENDIF} - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Inc(Lines[0].Current); CurrentNote := 0; if Lines[0].Current > Lines[0].High then Lines[0].Current := 0; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.AddLine(Lines[0].Current); Lyric.Selected := 0; @@ -655,12 +655,12 @@ begin PlaySentenceMidi := false; {$endif} - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Dec(Lines[0].Current); CurrentNote := 0; if Lines[0].Current = -1 then Lines[0].Current := Lines[0].High; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.AddLine(Lines[0].Current); Lyric.Selected := 0; @@ -722,11 +722,11 @@ begin // right if SDL_ModState = 0 then begin - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then CurrentNote := 0; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; end; end; @@ -735,11 +735,11 @@ begin // left if SDL_ModState = 0 then begin - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Dec(CurrentNote); if CurrentNote = -1 then CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; end; end; @@ -960,7 +960,7 @@ begin Lines[0].Current := Lines[0].Current + 1; CurrentNote := 0; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.AddLine(Lines[0].Current); end; @@ -1023,7 +1023,7 @@ begin Inc(Note[CurrentNote+1].Start); Dec(Note[CurrentNote+1].Length); Note[CurrentNote+1].Text := '- '; - Note[CurrentNote+1].Color := 0; + Note[CurrentNote+1].Color := 1; end; end; @@ -1053,7 +1053,7 @@ begin if CurrentNote > Lines[0].Line[C].HighNote then Dec(CurrentNote); - Lines[0].Line[C].Note[CurrentNote].Color := 1; + Lines[0].Line[C].Note[CurrentNote].Color := 2; end //Last Note of current Sentence Deleted - > Delete Sentence else @@ -1073,7 +1073,7 @@ begin else Lines[0].Current := 0; - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; end; end; end; @@ -1327,7 +1327,7 @@ begin Lines[0].Current := 0; CurrentNote := 0; - Lines[0].Line[0].Note[0].Color := 1; + Lines[0].Line[0].Note[0].Color := 2; AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); //Set Down Music Volume for Better hearability of Midi Sounds //Music.SetVolume(0.4); -- cgit v1.2.3 From 13220c16acafe9e9c1cab5a59a6be4ce38b43754 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sun, 6 Dec 2009 12:13:34 +0000 Subject: Add Date to Score, Filter Players, Switch Difficulty - ID: 2901824 applied patch form sf.net bug tracker (id: 2901824) thanks to brunzelchen - Add a date-column to the score entries (UNIX-Timestamp); the date will be shown on Top5- und Stats Screen! - The Players on Top-5-Screen are now filtered: Every player with his best score! - You can switch through the difficulties on Top-5-Screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1972 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenStatDetail.pas | 2 +- src/screens/UScreenTop5.pas | 78 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 77 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenStatDetail.pas b/src/screens/UScreenStatDetail.pas index 249626b0..1638cd85 100644 --- a/src/screens/UScreenStatDetail.pas +++ b/src/screens/UScreenStatDetail.pas @@ -234,7 +234,7 @@ begin if (Score > 0) then begin Text[I].Text := Format(FormatStr, - [Singer, Score, Theme.ILevel[Difficulty], SongArtist, SongTitle]); + [Singer, Score, Theme.ILevel[Difficulty], SongArtist, SongTitle, Date]); end; end; end; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index f9c86643..b0795f54 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -47,11 +47,13 @@ type public TextLevel: integer; TextArtistTitle: integer; + DifficultyShow: integer; StaticNumber: array[1..5] of integer; TextNumber: array[1..5] of integer; TextName: array[1..5] of integer; TextScore: array[1..5] of integer; + TextDate: array[1..5] of integer; Fadeout: boolean; @@ -59,6 +61,7 @@ type function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure OnShow; override; + procedure DrawScores(difficulty: integer); function Draw: boolean; override; end; @@ -98,6 +101,34 @@ begin Fadeout := true; end; end; + SDLK_RIGHT: + begin + inc(DifficultyShow); + if (DifficultyShow>2) then + DifficultyShow:=0; + DrawScores(DifficultyShow); + end; + SDLK_LEFT: + begin + dec(DifficultyShow); + if (DifficultyShow<0) then + DifficultyShow:=2; + DrawScores(DifficultyShow); + end; + SDLK_UP: + begin + inc(DifficultyShow); + if (DifficultyShow>2) then + DifficultyShow:=0; + DrawScores(DifficultyShow); + end; + SDLK_DOWN: + begin + dec(DifficultyShow); + if (DifficultyShow<0) then + DifficultyShow:=2; + DrawScores(DifficultyShow); + end; SDLK_SYSREQ: begin Display.SaveScreenShot; @@ -133,6 +164,7 @@ begin TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]); TextName[I+1] := AddText (Theme.Top5.TextName[I]); TextScore[I+1] := AddText (Theme.Top5.TextScore[I]); + TextDate[I+1] := AddText (Theme.Top5.TextDate[I]); end; end; @@ -141,10 +173,13 @@ procedure TScreenTop5.OnShow; var I: integer; PMax: integer; + sung: boolean; //score added? otherwise in wasn't sung! begin inherited; + sung := false; Fadeout := false; + DifficultyShow := Ini.Difficulty; //ReadScore(CurrentSong); @@ -152,9 +187,16 @@ begin if PMax = 4 then PMax := 5; for I := 0 to PMax do - DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); + begin + if (Round(Player[I].ScoreTotalInt) > 0) then + begin + DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); + sung:=true; + end; + end; - DataBase.WriteScore(CurrentSong); + if sung then + DataBase.WriteScore(CurrentSong); DataBase.ReadScore(CurrentSong); Text[TextArtistTitle].Text := CurrentSong.Artist + ' - ' + CurrentSong.Title; @@ -165,9 +207,11 @@ begin Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; + Text[TextDate[I]].Visible := true; Text[TextName[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Name; Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); + Text[TextDate[I]].Text := CurrentSong.Score[Ini.Difficulty, I-1].Date; end; for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do @@ -176,11 +220,41 @@ begin Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; Text[TextScore[I]].Visible := false; + Text[TextDate[I]].Visible := false; end; Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; end; +procedure TScreenTop5.DrawScores(difficulty: integer); +var + I: integer; +begin + for I := 1 to Length(CurrentSong.Score[difficulty]) do + begin + Static[StaticNumber[I]].Visible := true; + Text[TextNumber[I]].Visible := true; + Text[TextName[I]].Visible := true; + Text[TextScore[I]].Visible := true; + Text[TextDate[I]].Visible := true; + + Text[TextName[I]].Text := CurrentSong.Score[difficulty, I-1].Name; + Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[difficulty, I-1].Score); + Text[TextDate[I]].Text := CurrentSong.Score[difficulty, I-1].Date; + end; + + for I := Length(CurrentSong.Score[difficulty]) + 1 to 5 do + begin + Static[StaticNumber[I]].Visible := false; + Text[TextNumber[I]].Visible := false; + Text[TextName[I]].Visible := false; + Text[TextScore[I]].Visible := false; + Text[TextDate[I]].Visible := false; + end; + + Text[TextLevel].Text := IDifficulty[difficulty]; +end; + function TScreenTop5.Draw: boolean; //var { -- cgit v1.2.3 From ba2e579b547b5331a2bcd900de04ae50818ada84 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sun, 6 Dec 2009 14:40:10 +0000 Subject: fix bugtracker issue 2817034 if selected to show the name screen after song select, than this screen is now not shown before song select git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1975 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenLevel.pas | 10 ++++++---- src/screens/UScreenMain.pas | 9 +++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenLevel.pas b/src/screens/UScreenLevel.pas index 4d7d8b5e..1ead9773 100644 --- a/src/screens/UScreenLevel.pas +++ b/src/screens/UScreenLevel.pas @@ -74,14 +74,18 @@ begin Exit; end; end; - + // check special keys case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenName); + + if Ini.OnSongClick = sSelectPlayer then + FadeTo(@ScreenMain) + else + FadeTo(@ScreenName); end; SDLK_RETURN: @@ -106,8 +110,6 @@ begin end; constructor TScreenLevel.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 7237eb80..ca4ba7cc 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -136,8 +136,13 @@ begin if (Ini.Players = 4) then PlayersPlay := 6; - ScreenName.Goto_SingScreen := false; - FadeTo(@ScreenName, SoundLib.Start); + if Ini.OnSongClick = sSelectPlayer then + FadeTo(@ScreenLevel) + else + begin + ScreenName.Goto_SingScreen := false; + FadeTo(@ScreenName, SoundLib.Start); + end; end else //show error message ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); -- cgit v1.2.3 From c5c8fd69256016ebd39f2de51cad9e35974bc703 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 6 Dec 2009 22:14:34 +0000 Subject: fix performance problem on scroll git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@1999 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 44 ++++++++++++++++++++------------------- src/screens/UScreenSongJumpto.pas | 2 +- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 7cfb0b0a..c2afbfe1 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -128,8 +128,8 @@ type procedure GenerateThumbnails(); procedure OnShow; override; procedure OnHide; override; - procedure SelectNext; - procedure SelectPrev; + procedure SelectNext(UnloadCover: boolean); + procedure SelectPrev(UnloadCover: boolean); procedure SkipTo(Target: cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix @@ -434,7 +434,7 @@ begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext(true); FixSelected; break; end; @@ -462,7 +462,7 @@ begin ShowCatTL (I); CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext(true); // Fix: not existing song selected: //if (I + 1 = I2) then @@ -516,9 +516,9 @@ begin HideCatTL; //Show Wrong Song when Tabs on Fix - SelectNext; + SelectNext(true); FixSelected; - //SelectPrev; + //SelectPrev(true); //CatSongs.Song[0].Visible := false; end else @@ -535,7 +535,7 @@ begin Interaction := 0; //Show Wrong Song when Tabs on Fix - SelectNext; + SelectNext(true); FixSelected; ChangeMusic; @@ -575,7 +575,7 @@ begin // SetScroll4; //Show Wrong Song when Tabs on Fix - SelectNext; + SelectNext(true); FixSelected; //Play Music: @@ -635,7 +635,7 @@ begin ShowCatTL (Interaction); CatSongs.ClickCategoryButton(Interaction); - SelectNext; + SelectNext(true); FixSelected; //Play Music: @@ -679,7 +679,7 @@ begin ShowCatTL (I); CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext(true); FixSelected; //Play Music: @@ -696,7 +696,7 @@ begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin AudioPlayback.PlaySound(SoundLib.Change); - SelectNext; + SelectNext(true); //InteractNext; //SongTarget := Interaction; ChangeMusic; @@ -709,7 +709,7 @@ begin if (Songs.SongList.Count > 0)and (Mode = smNormal) then begin AudioPlayback.PlaySound(SoundLib.Change); - SelectPrev; + SelectPrev(true); ChangeMusic; SetScroll4; end; @@ -1532,7 +1532,7 @@ begin //If Playlist Shown -> Select Next automatically if (CatSongs.CatNumShow = -3) then begin - SelectNext; + SelectNext(true); ChangeMusic; end; end @@ -1662,7 +1662,7 @@ begin Result := true; end; -procedure TScreenSong.SelectNext; +procedure TScreenSong.SelectNext(UnloadCover: boolean); var Skip: integer; VS: integer; @@ -1671,7 +1671,8 @@ begin if VS > 0 then begin - UnLoadDetailedCover; + if UnloadCover then //that should fix the performance problem on scrolling + UnLoadDetailedCover; Skip := 1; @@ -1697,7 +1698,7 @@ begin //Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); end; -procedure TScreenSong.SelectPrev; +procedure TScreenSong.SelectPrev(UnloadCover: boolean); var Skip: integer; VS: integer; @@ -1706,7 +1707,8 @@ begin if VS > 0 then begin - UnLoadDetailedCover; + if UnloadCover then + UnLoadDetailedCover; //that should fix the performance problem on scrolling Skip := 1; @@ -1811,7 +1813,7 @@ begin SongTarget := 0; for i := 1 to Target+1 do - SelectNext; + SelectNext(false); FixSelected2; end; @@ -1845,7 +1847,7 @@ begin ShowCatTL(I); CatSongs.ClickCategoryButton(I); - SelectNext; + SelectNext(true); // choose song SkipTo(I2 - I); @@ -1860,7 +1862,7 @@ begin CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); ShowCatTL(PlaylistMan.CurPlayList); - SelectNext; + SelectNext(true); FixSelected2; SkipTo(Random(CatSongs.VisibleSongs)); @@ -2054,7 +2056,7 @@ begin CatSongs.Refresh; CatSongs.ShowCategoryList; Interaction := 0; - SelectNext; + SelectNext(true); FixSelected; } end; diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index 3a199576..7f82bbec 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -229,7 +229,7 @@ begin //Fix SongSelection ScreenSong.Interaction := high(CatSongs.Song); - ScreenSong.SelectNext; + ScreenSong.SelectNext(true); ScreenSong.FixSelected; //Play Correct Music -- cgit v1.2.3 From 526ba53e63926cf2837a9e8feb7cda3ac8526300 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Mon, 7 Dec 2009 21:47:43 +0000 Subject: add the score to db only if the song was sung to the end (last word of last sentence+length) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2002 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 17 +++++++++++++++++ src/screens/UScreenTop5.pas | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20805737..342abac1 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -98,6 +98,9 @@ type // score manager: Scores: TSingScores; + //the song was sung to the end + SungToEnd: boolean; + fShowVisualization: boolean; fCurrentVideoPlaybackEngine: IVideoPlayback; @@ -329,6 +332,9 @@ begin Log.LogStatus('Begin', 'OnShow'); FadeOut := false; + //the song was sung to the end + SungToEnd := false; + // reset video playback engine, to play video clip ... fCurrentVideoPlaybackEngine := VideoPlayback; @@ -666,6 +672,8 @@ var Sec: integer; T: integer; CurLyricsTime: real; + Line: TLyricLine; + LastWord: TLyricWord; begin Background.Draw; @@ -751,6 +759,15 @@ begin // Note: there is no menu and the animated background brakes the video playback //DrawBG; + //the song was sung to the end? + Line := Lyrics.GetUpperLine(); + if Line.LastLine then + begin + LastWord := Line.Words[Length(Line.Words)-1]; + if CurLyricsTime >= GetTimeFromBeat(LastWord.Start+LastWord.Length) then + SungToEnd := true; + end; + // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index b0795f54..2ddff713 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -188,7 +188,7 @@ begin PMax := 5; for I := 0 to PMax do begin - if (Round(Player[I].ScoreTotalInt) > 0) then + if (Round(Player[I].ScoreTotalInt) > 0) and (ScreenSing.SungToEnd) then begin DataBase.AddScore(CurrentSong, Ini.Difficulty, Ini.Name[I], Round(Player[I].ScoreTotalInt)); sung:=true; -- cgit v1.2.3 From 9b312c379c3674e68374704a84e0926d51239584 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Tue, 8 Dec 2009 19:45:14 +0000 Subject: removed if to enable folder cover loading git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2004 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index c2afbfe1..bd5eebe5 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -940,15 +940,8 @@ begin Song := CatSongs.Song[I]; - if not Song.Main then - begin // to-do : load category covers again... - // just a workaround to fic folders=on for the moment... - // if cover-image is not found then show 'no cover' - CoverFile := Song.Path.Append(Song.Cover); - if (not CoverFile.IsFile()) then - Song.Cover := PATH_NONE; - end - else + CoverFile := Song.Path.Append(Song.Cover); + if (not CoverFile.IsFile()) then Song.Cover := PATH_NONE; if (Song.Cover.IsUnset) then -- cgit v1.2.3 From 46e4f20c37be63c326b9ac798c656c266301d5b0 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 13 Dec 2009 13:32:09 +0000 Subject: fixed score display with linebonus=off git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2026 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 342abac1..20f3b15e 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -956,7 +956,9 @@ begin // spawn rating pop-up Rating := Round(LinePerfection * MAX_LINE_RATING); Scores.SpawnPopUp(PlayerIndex, Rating, CurrentPlayer.ScoreTotalInt); - end; + end + else + Scores.RaiseScore(PlayerIndex, CurrentPlayer.ScoreTotalInt); // PerfectLineTwinkle (effect), part 1 if (Ini.EffectSing = 1) then -- cgit v1.2.3 From 667a4f92bdd283249e4d7e525eeb7e7c665d1d17 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 13 Dec 2009 13:49:07 +0000 Subject: fixed bug: Audio-file does not exist: "" [UAudio_FFmpeg] git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2029 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index bd5eebe5..e43e2196 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1733,6 +1733,10 @@ begin if not assigned(Song) then Exit; + //fix: if main cat than there is nothing to play + if Song.main then + Exit; + if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then begin PreviewOpened := Interaction; -- cgit v1.2.3 From bbec4bdd80154e4a29cb56cd94fded55ac5d5efb Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 13 Dec 2009 14:09:10 +0000 Subject: now the Audio-file bug should be fixed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2031 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index e43e2196..a2760ae3 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1547,8 +1547,8 @@ end; procedure TScreenSong.OnHide; begin - // if preview is not loaded: load musicfile now - if (PreviewOpened <> Interaction) then + // if preview is not loaded: load musicfile now; not on cat-main! + if (PreviewOpened <> Interaction) and not CatSongs.Song[Interaction].main then AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); // turn music volume to 100% -- cgit v1.2.3 From 29d0e397e5201df416ff5fa2cc8101276697fffb Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 17 Dec 2009 20:24:18 +0000 Subject: Just a test. Probably ignore this! git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2045 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a2760ae3..305088e5 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1548,11 +1548,12 @@ end; procedure TScreenSong.OnHide; begin // if preview is not loaded: load musicfile now; not on cat-main! - if (PreviewOpened <> Interaction) and not CatSongs.Song[Interaction].main then - AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); +// if (PreviewOpened <> Interaction) then // turn music volume to 100% AudioPlayback.SetVolume(1.0); + if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then + AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); // if hide then stop music (for party mode popup on exit) if (Display.NextScreen <> @ScreenSing) and -- cgit v1.2.3 From 988ccd68a2b6b89dd1a9e622ea15be2bcc2d6270 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 17 Dec 2009 20:51:31 +0000 Subject: revert previous commit. It did not solve the problem of non song on fedora. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2046 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 305088e5..a2760ae3 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1548,12 +1548,11 @@ end; procedure TScreenSong.OnHide; begin // if preview is not loaded: load musicfile now; not on cat-main! -// if (PreviewOpened <> Interaction) then + if (PreviewOpened <> Interaction) and not CatSongs.Song[Interaction].main then + AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); // turn music volume to 100% AudioPlayback.SetVolume(1.0); - if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then - AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); // if hide then stop music (for party mode popup on exit) if (Display.NextScreen <> @ScreenSing) and -- cgit v1.2.3 From 115be023b64d9de135a09ab2a63553856eef15d9 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Sun, 20 Dec 2009 20:35:40 +0000 Subject: changed TSyncSource to interface ISyncSource git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2051 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20f3b15e..0b7dfba4 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -53,8 +53,8 @@ uses UTime; type - TLyricsSyncSource = class(TSyncSource) - function GetClock(): real; override; + TLyricsSyncSource = class(TInterfacedObject,ISyncSource) + function GetClock(): real; end; type -- cgit v1.2.3 From b17406af2d096cb1db7eb193118dff0c48f4761b Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Tue, 22 Dec 2009 18:56:20 +0000 Subject: fix: divide sentence in editor leaded to crash update of authors.txt and copyright.txt git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2053 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 609a689b..10584ce8 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -934,7 +934,7 @@ begin begin Inc(HighNote); SetLength(Note, HighNote + 1); - Note[HighNote] := Note[N]; + Note[HighNote] := Lines[0].Line[CStart].Note[N]; End_ := Note[HighNote].Start + Note[HighNote].Length; if Note[HighNote].Tone < BaseNote then -- cgit v1.2.3 From 1b38db896c698b754ff145931e432f4f3ee05345 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Tue, 29 Dec 2009 14:04:52 +0000 Subject: revert submission 2051. leeds to crash on 2nd song. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2056 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 0b7dfba4..20f3b15e 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -53,8 +53,8 @@ uses UTime; type - TLyricsSyncSource = class(TInterfacedObject,ISyncSource) - function GetClock(): real; + TLyricsSyncSource = class(TSyncSource) + function GetClock(): real; override; end; type -- cgit v1.2.3 From 4711217f127aa0c10fa52755fd567c570277a1a1 Mon Sep 17 00:00:00 2001 From: s_alexander Date: Tue, 12 Jan 2010 17:42:41 +0000 Subject: merged lua into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2071 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 19 +-- src/screens/UScreenPartyNewRound.pas | 272 ++++++++++------------------------- src/screens/UScreenPartyOptions.pas | 90 ++++-------- src/screens/UScreenPartyPlayer.pas | 206 ++++++++++++++++---------- src/screens/UScreenPartyRounds.pas | 237 ++++++++++++++++++++++++++++++ src/screens/UScreenPartyScore.pas | 107 +++++++------- src/screens/UScreenPartyWin.pas | 52 ++++--- src/screens/UScreenSing.pas | 62 +++++++- src/screens/UScreenSong.pas | 78 ++++------ src/screens/UScreenSongMenu.pas | 25 ++-- 10 files changed, 650 insertions(+), 498 deletions(-) create mode 100644 src/screens/UScreenPartyRounds.pas (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index ca4ba7cc..b342281c 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -153,12 +153,7 @@ begin begin if (Songs.SongList.Count >= 1) then begin - if (Length(DLLMan.Plugins) >= 1) then - begin - FadeTo(@ScreenPartyOptions, SoundLib.Start); - end - else //show error message, No Plugins Loaded - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + FadeTo(@ScreenPartyOptions, SoundLib.Start); end else //show error message, No Songs Loaded ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_SONGS')); @@ -241,12 +236,18 @@ procedure TScreenMain.OnShow; begin inherited; + {** + * Clean up TPartyGame here + * at the moment there is no better place for this + *} + Party.Clear; + { display cursor (on moved) } Display.SetCursor; -{** - * Start background music - *} + {** + * Start background music + *} SoundLib.StartBgMusic; end; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index c4295502..b52efd21 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -46,21 +46,9 @@ type TScreenPartyNewRound = class(TMenu) public //Texts: - TextRound1: cardinal; - TextRound2: cardinal; - TextRound3: cardinal; - TextRound4: cardinal; - TextRound5: cardinal; - TextRound6: cardinal; - TextRound7: cardinal; - - TextWinner1: cardinal; - TextWinner2: cardinal; - TextWinner3: cardinal; - TextWinner4: cardinal; - TextWinner5: cardinal; - TextWinner6: cardinal; - TextWinner7: cardinal; + TextRound: array [0..6] of cardinal; + + TextWinner: array [0..6] of cardinal; TextNextRound: cardinal; TextNextRoundNo: cardinal; @@ -69,13 +57,7 @@ type TextNextPlayer3: cardinal; //Statics - StaticRound1: cardinal; - StaticRound2: cardinal; - StaticRound3: cardinal; - StaticRound4: cardinal; - StaticRound5: cardinal; - StaticRound6: cardinal; - StaticRound7: cardinal; + StaticRound: array [0..6] of cardinal; //Scores TextScoreTeam1: cardinal; @@ -144,16 +126,7 @@ begin SDLK_RETURN: begin AudioPlayback.PlaySound(SoundLib.Start); - if DLLMan.Selected.LoadSong then - begin - //Select PartyMode ScreenSong - ScreenSong.Mode := smPartyMode; - FadeTo(@ScreenSong); - end - else - begin - FadeTo(@ScreenSingModi); - end; + Party.CallBeforeSongSelect; end; end; end; @@ -163,21 +136,21 @@ constructor TScreenPartyNewRound.Create; begin inherited Create; - TextRound1 := AddText (Theme.PartyNewRound.TextRound1); - TextRound2 := AddText (Theme.PartyNewRound.TextRound2); - TextRound3 := AddText (Theme.PartyNewRound.TextRound3); - TextRound4 := AddText (Theme.PartyNewRound.TextRound4); - TextRound5 := AddText (Theme.PartyNewRound.TextRound5); - TextRound6 := AddText (Theme.PartyNewRound.TextRound6); - TextRound7 := AddText (Theme.PartyNewRound.TextRound7); - - TextWinner1 := AddText (Theme.PartyNewRound.TextWinner1); - TextWinner2 := AddText (Theme.PartyNewRound.TextWinner2); - TextWinner3 := AddText (Theme.PartyNewRound.TextWinner3); - TextWinner4 := AddText (Theme.PartyNewRound.TextWinner4); - TextWinner5 := AddText (Theme.PartyNewRound.TextWinner5); - TextWinner6 := AddText (Theme.PartyNewRound.TextWinner6); - TextWinner7 := AddText (Theme.PartyNewRound.TextWinner7); + TextRound[0] := AddText (Theme.PartyNewRound.TextRound1); + TextRound[1] := AddText (Theme.PartyNewRound.TextRound2); + TextRound[2] := AddText (Theme.PartyNewRound.TextRound3); + TextRound[3] := AddText (Theme.PartyNewRound.TextRound4); + TextRound[4] := AddText (Theme.PartyNewRound.TextRound5); + TextRound[5] := AddText (Theme.PartyNewRound.TextRound6); + TextRound[6] := AddText (Theme.PartyNewRound.TextRound7); + + TextWinner[0] := AddText (Theme.PartyNewRound.TextWinner1); + TextWinner[1] := AddText (Theme.PartyNewRound.TextWinner2); + TextWinner[2] := AddText (Theme.PartyNewRound.TextWinner3); + TextWinner[3] := AddText (Theme.PartyNewRound.TextWinner4); + TextWinner[4] := AddText (Theme.PartyNewRound.TextWinner5); + TextWinner[5] := AddText (Theme.PartyNewRound.TextWinner6); + TextWinner[6] := AddText (Theme.PartyNewRound.TextWinner7); TextNextRound := AddText (Theme.PartyNewRound.TextNextRound); TextNextRoundNo := AddText (Theme.PartyNewRound.TextNextRoundNo); @@ -185,13 +158,13 @@ begin TextNextPlayer2 := AddText (Theme.PartyNewRound.TextNextPlayer2); TextNextPlayer3 := AddText (Theme.PartyNewRound.TextNextPlayer3); - StaticRound1 := AddStatic (Theme.PartyNewRound.StaticRound1); - StaticRound2 := AddStatic (Theme.PartyNewRound.StaticRound2); - StaticRound3 := AddStatic (Theme.PartyNewRound.StaticRound3); - StaticRound4 := AddStatic (Theme.PartyNewRound.StaticRound4); - StaticRound5 := AddStatic (Theme.PartyNewRound.StaticRound5); - StaticRound6 := AddStatic (Theme.PartyNewRound.StaticRound6); - StaticRound7 := AddStatic (Theme.PartyNewRound.StaticRound7); + StaticRound[0] := AddStatic (Theme.PartyNewRound.StaticRound1); + StaticRound[1] := AddStatic (Theme.PartyNewRound.StaticRound2); + StaticRound[2] := AddStatic (Theme.PartyNewRound.StaticRound3); + StaticRound[3] := AddStatic (Theme.PartyNewRound.StaticRound4); + StaticRound[4] := AddStatic (Theme.PartyNewRound.StaticRound5); + StaticRound[5] := AddStatic (Theme.PartyNewRound.StaticRound6); + StaticRound[6] := AddStatic (Theme.PartyNewRound.StaticRound7); //Scores TextScoreTeam1 := AddText (Theme.PartyNewRound.TextScoreTeam1); @@ -219,18 +192,18 @@ end; procedure TScreenPartyNewRound.OnShow; var I: integer; - function GetTeamPlayers(const Num: byte): UTF8String; + function GetTeamPlayers(const Num: integer): UTF8String; var Players: array of UTF8String; - J: byte; + J: integer; begin - if (Num-1 >= PartySession.Teams.NumTeams) then + if (Num > High(Party.Teams)) or (Num < 0) then exit; //Create Players array - SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); - for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := UTF8String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + SetLength(Players, Length(Party.Teams[Num].Players)); + For J := 0 to High(Party.Teams[Num].Players) do + Players[J] := UTF8String(Party.Teams[Num].Players[J].Name); //Implode and Return Result := Language.Implode(Players); @@ -238,135 +211,34 @@ var begin inherited; - PartySession.StartRound; - //Set Visibility of Round Infos - I := Length(PartySession.Rounds); - if (I >= 1) then - begin - Static[StaticRound1].Visible := true; - Text[TextRound1].Visible := true; - Text[TextWinner1].Visible := true; - - //Texts: - Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - Text[TextWinner1].Text := PartySession.GetWinnerString(0); - end - else - begin - Static[StaticRound1].Visible := false; - Text[TextRound1].Visible := false; - Text[TextWinner1].Visible := false; - end; - - if (I >= 2) then - begin - Static[StaticRound2].Visible := true; - Text[TextRound2].Visible := true; - Text[TextWinner2].Visible := true; - - //Texts: - Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - Text[TextWinner2].Text := PartySession.GetWinnerString(1); - end - else - begin - Static[StaticRound2].Visible := false; - Text[TextRound2].Visible := false; - Text[TextWinner2].Visible := false; - end; - - if (I >= 3) then - begin - Static[StaticRound3].Visible := true; - Text[TextRound3].Visible := true; - Text[TextWinner3].Visible := true; - - //Texts: - Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - Text[TextWinner3].Text := PartySession.GetWinnerString(2); - end - else - begin - Static[StaticRound3].Visible := false; - Text[TextRound3].Visible := false; - Text[TextWinner3].Visible := false; - end; - - if (I >= 4) then - begin - Static[StaticRound4].Visible := true; - Text[TextRound4].Visible := true; - Text[TextWinner4].Visible := true; - - //Texts: - Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - Text[TextWinner4].Text := PartySession.GetWinnerString(3); - end - else + for I := 0 to 6 do begin - Static[StaticRound4].Visible := false; - Text[TextRound4].Visible := false; - Text[TextWinner4].Visible := false; - end; - - if (I >= 5) then - begin - Static[StaticRound5].Visible := true; - Text[TextRound5].Visible := true; - Text[TextWinner5].Visible := true; - - //Texts: - Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - Text[TextWinner5].Text := PartySession.GetWinnerString(4); - end - else - begin - Static[StaticRound5].Visible := false; - Text[TextRound5].Visible := false; - Text[TextWinner5].Visible := false; - end; - - if (I >= 6) then - begin - Static[StaticRound6].Visible := true; - Text[TextRound6].Visible := true; - Text[TextWinner6].Visible := true; - - //Texts: - Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - Text[TextWinner6].Text := PartySession.GetWinnerString(5); - end - else - begin - Static[StaticRound6].Visible := false; - Text[TextRound6].Visible := false; - Text[TextWinner6].Visible := false; + if (I <= High(Party.Rounds)) then + begin + Static[StaticRound[I]].Visible := True; + Text[TextRound[I]].Visible := True; + Text[TextWinner[I]].Visible := True; + + // update texts: + Text[TextRound[I]].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[I].Mode].Name) + '_NAME'); + Text[TextWinner[I]].Text := Party.GetWinnerString(I); + end + else + begin + Static[StaticRound[I]].Visible := False; + Text[TextRound[I]].Visible := False; + Text[TextWinner[I]].Visible := False; + end; end; - if (I >= 7) then - begin - Static[StaticRound7].Visible := true; - Text[TextRound7].Visible := true; - Text[TextWinner7].Visible := true; - - //Texts: - Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - Text[TextWinner7].Text := PartySession.GetWinnerString(6); - end - else - begin - Static[StaticRound7].Visible := false; - Text[TextRound7].Visible := false; - Text[TextWinner7].Visible := false; - end; //Display Scores - if (PartySession.Teams.NumTeams >= 1) then + if (Length(Party.Teams) >= 1) then begin - Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := UTF8String(PartySession.Teams.TeamInfo[0].Name); - Text[TextTeam1Players].Text := GetTeamPlayers(1); + Text[TextScoreTeam1].Text := InttoStr(Party.Teams[0].Score); + Text[TextNameTeam1].Text := UTF8String(Party.Teams[0].Name); + Text[TextTeam1Players].Text := GetTeamPlayers(0); Text[TextScoreTeam1].Visible := true; Text[TextNameTeam1].Visible := true; @@ -383,11 +255,11 @@ begin Static[StaticNextPlayer1].Visible := false; end; - if (PartySession.Teams.NumTeams >= 2) then + if (Length(Party.Teams) >= 2) then begin - Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := UTF8String(PartySession.Teams.TeamInfo[1].Name); - Text[TextTeam2Players].Text := GetTeamPlayers(2); + Text[TextScoreTeam2].Text := InttoStr(Party.Teams[1].Score); + Text[TextNameTeam2].Text := UTF8String(Party.Teams[1].Name); + Text[TextTeam2Players].Text := GetTeamPlayers(1); Text[TextScoreTeam2].Visible := true; Text[TextNameTeam2].Visible := true; @@ -404,11 +276,11 @@ begin Static[StaticNextPlayer2].Visible := false; end; - if (PartySession.Teams.NumTeams >= 3) then + if (Length(Party.Teams) >= 3) then begin - Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := UTF8String(PartySession.Teams.TeamInfo[2].Name); - Text[TextTeam3Players].Text := GetTeamPlayers(3); + Text[TextScoreTeam3].Text := InttoStr(Party.Teams[2].Score); + Text[TextNameTeam3].Text := UTF8String(Party.Teams[2].Name); + Text[TextTeam3Players].Text := GetTeamPlayers(2); Text[TextScoreTeam3].Visible := true; Text[TextNameTeam3].Visible := true; @@ -423,30 +295,30 @@ begin Text[TextTeam3Players].Visible := false; Static[StaticTeam3].Visible := false; Static[StaticNextPlayer3].Visible := false; - end; + end; //nextRound Texts - Text[TextNextRound].Text := Language.Translate(DllMan.Selected.PluginDesc); - Text[TextNextRoundNo].Text := InttoStr(PartySession.CurRound + 1); - if (PartySession.Teams.NumTeams >= 1) then + Text[TextNextRound].Text := Language.Translate('MODE_' + uppercase(Party.Modes[Party.Rounds[Party.CurrentRound].Mode].Name) + '_DESC'); + Text[TextNextRoundNo].Text := InttoStr(Party.CurrentRound + 1); + if (Length(Party.Teams) >= 1) then begin - Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; + Text[TextNextPlayer1].Text := Party.Teams[0].Players[Party.Teams[0].NextPlayer].Name; Text[TextNextPlayer1].Visible := true; end else Text[TextNextPlayer1].Visible := false; - - if (PartySession.Teams.NumTeams >= 2) then + + if (Length(Party.Teams) >= 2) then begin - Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; + Text[TextNextPlayer2].Text := Party.Teams[1].Players[Party.Teams[1].NextPlayer].Name; Text[TextNextPlayer2].Visible := true; end else Text[TextNextPlayer2].Visible := false; - if (PartySession.Teams.NumTeams >= 3) then + if (Length(Party.Teams) >= 3) then begin - Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; + Text[TextNextPlayer3].Text := Party.Teams[2].Players[Party.Teams[2].NextPlayer].Name; Text[TextNextPlayer3].Visible := true; end else diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 2deffda6..3dce9954 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -44,38 +44,26 @@ uses type TScreenPartyOptions = class(TMenu) - public + private SelectLevel: cardinal; SelectPlayList: cardinal; SelectPlayList2: cardinal; SelectRounds: cardinal; - SelectTeams: cardinal; - SelectPlayers1: cardinal; - SelectPlayers2: cardinal; - SelectPlayers3: cardinal; + + IPlaylist: array[0..2] of UTF8String; + IPlaylist2: array of UTF8String; PlayList: integer; PlayList2: integer; - Rounds: integer; - NumTeams: integer; - NumPlayer1, NumPlayer2, NumPlayer3: integer; - + + procedure SetPlaylist2; + public constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure OnShow; override; procedure SetAnimationProgress(Progress: real); override; - procedure SetPlaylist2; end; -var - IPlaylist: array[0..2] of UTF8String; - IPlaylist2: array of UTF8String; - - const - ITeams: array[0..1] of UTF8String = ('2', '3'); - IPlayers: array[0..3] of UTF8String = ('1', '2', '3', '4'); - IRounds: array[0..5] of UTF8String = ('2', '3', '4', '5', '6', '7'); - implementation uses @@ -122,27 +110,11 @@ begin //Don'T start when Playlist is Selected and there are no Playlists if (Playlist = 2) and (Length(PlaylistMan.Playlists) = 0) then Exit; - // Don't start when SinglePlayer Teams but only Multiplayer Plugins available - OnlyMultiPlayer := true; - for I := 0 to High(DLLMan.Plugins) do - begin - OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly); - end; - if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then - begin - ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); - Exit; - end; + //Save Difficulty Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; - //Save Num Teams: - PartySession.Teams.NumTeams := NumTeams + 2; - PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; - PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; - PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; - //Save Playlist PlaylistMan.Mode := TSingMode( Playlist ); PlaylistMan.CurPlayList := High(cardinal); @@ -169,9 +141,6 @@ begin else PlaylistMan.CurPlayList := Playlist2; - //Start Party - PartySession.StartNewParty(Rounds + 2); - AudioPlayback.PlaySound(SoundLib.Start); //Go to Player Screen FadeTo(@ScreenPartyPlayer); @@ -191,10 +160,6 @@ begin if (Interaction = 1) then begin SetPlaylist2; - end //Change Team3 Players visibility - else if (Interaction = 4) then - begin - SelectsS[7].Visible := (NumTeams = 1); end; end; SDLK_LEFT: @@ -206,10 +171,6 @@ begin if (Interaction = 1) then begin SetPlaylist2; - end //Change Team3 Players visibility - else if (Interaction = 4) then - begin - SelectsS[7].Visible := (NumTeams = 1); end; end; end; @@ -229,30 +190,25 @@ begin IPlaylist2[0] := '---'; //Clear all Selects - NumTeams := 0; - NumPlayer1 := 0; - NumPlayer2 := 0; - NumPlayer3 := 0; - Rounds := 5; PlayList := 0; PlayList2 := 0; //Load Screen From Theme LoadFromTheme(Theme.PartyOptions); + Theme.PartyOptions.SelectLevel.oneItemOnly := true; + Theme.PartyOptions.SelectLevel.showArrows := true; SelectLevel := AddSelectSlide(Theme.PartyOptions.SelectLevel, Ini.Difficulty, Theme.ILevel); + + Theme.PartyOptions.SelectPlayList.oneItemOnly := true; + Theme.PartyOptions.SelectPlayList.showArrows := true; SelectPlayList := AddSelectSlide(Theme.PartyOptions.SelectPlayList, PlayList, IPlaylist); + + Theme.PartyOptions.SelectPlayList2.oneItemOnly := true; + Theme.PartyOptions.SelectPlayList2.showArrows := true; SelectPlayList2 := AddSelectSlide(Theme.PartyOptions.SelectPlayList2, PlayList2, IPlaylist2); - SelectRounds := AddSelectSlide(Theme.PartyOptions.SelectRounds, Rounds, IRounds); - SelectTeams := AddSelectSlide(Theme.PartyOptions.SelectTeams, NumTeams, ITeams); - SelectPlayers1 := AddSelectSlide(Theme.PartyOptions.SelectPlayers1, NumPlayer1, IPlayers); - SelectPlayers2 := AddSelectSlide(Theme.PartyOptions.SelectPlayers2, NumPlayer2, IPlayers); - SelectPlayers3 := AddSelectSlide(Theme.PartyOptions.SelectPlayers3, NumPlayer3, IPlayers); Interaction := 0; - - //Hide Team3 Players - SelectsS[7].Visible := false; end; procedure TScreenPartyOptions.SetPlaylist2; @@ -306,7 +262,19 @@ procedure TScreenPartyOptions.OnShow; begin inherited; - Randomize; + Party.Clear; + + // check if there are loaded modes + if Party.ModesAvailable then + begin + // modes are loaded + Randomize; + end + else + begin // no modes found + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); + Display.AbortScreenChange; + end; end; procedure TScreenPartyOptions.SetAnimationProgress(Progress: real); diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index 887d5202..3fcaa4ba 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -44,6 +44,14 @@ uses type TScreenPartyPlayer = class(TMenu) + private + CountTeams: integer; + CountPlayer: array [0..2] of integer; + + SelectTeams: cardinal; + SelectPlayers: array [0..2] of cardinal; + procedure UpdateInterface; + procedure UpdateParty; public Team1Name: cardinal; Player1Name: cardinal; @@ -69,6 +77,10 @@ type procedure SetAnimationProgress(Progress: real); override; end; +const + ITeams: array[0..1] of UTF8String = ('2', '3'); + IPlayers: array[0..3] of UTF8String = ('1', '2', '3', '4'); + implementation uses @@ -77,24 +89,92 @@ uses UIni, UTexture, UParty, - UUnicodeUtils; + UUnicodeUtils, + UScreenPartyOptions, + ULanguage; + +procedure TScreenPartyPlayer.UpdateInterface; + var + I: integer; + Btn: integer; +begin + SelectsS[SelectPlayers[2]].Visible := (CountTeams = 1); + + Btn := 0; + for I := 0 to 2 do + begin + if (CountTeams + 1 >= I) then + begin + Button[Btn + 0].Visible := true; + Button[Btn + 1].Visible := (CountPlayer[I] + 1 >= 1); + Button[Btn + 2].Visible := (CountPlayer[I] + 1 >= 2); + Button[Btn + 3].Visible := (CountPlayer[I] + 1 >= 3); + Button[Btn + 4].Visible := (CountPlayer[I] + 1 >= 4); + end + else + begin + Button[Btn + 0].Visible := false; + Button[Btn + 1].Visible := false; + Button[Btn + 2].Visible := false; + Button[Btn + 3].Visible := false; + Button[Btn + 4].Visible := false; + end; + Inc(Btn, 5); + end; +end; + +procedure TScreenPartyPlayer.UpdateParty; + var + I, J: integer; + Rounds: ARounds; +begin + {//Save PlayerNames + for I := 0 to PartySession.Teams.NumTeams-1 do + begin + PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); + for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do + begin + PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); + PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; + end; + end; } + + // add teams to party + + for I := 0 to CountTeams + 1 do + begin + Party.AddTeam(Button[I * 5].Text[0].Text); + + for J := 0 to CountPlayer[I] do + Party.AddPlayer(I, Button[I * 5 + 1 + J].Text[0].Text); + end; + + if (Party.ModesAvailable) then + begin //mode for current playersetup available + FadeTo(@ScreenPartyRounds, SoundLib.Start); + end + else + begin + // no mode available for current player setup + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_MODES_FOR_CURRENT_SETUP')); + Party.Clear; + end; +end; function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var SDL_ModState: word; - I, J: integer; - procedure IntNext; begin repeat InteractNext; - until Button[Interaction].Visible; + until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible); end; procedure IntPrev; begin repeat InteractPrev; - until Button[Interaction].Visible; + until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible); end; begin Result := true; @@ -244,31 +324,31 @@ begin FadeTo(@ScreenPartyOptions); end; - SDLK_RETURN: - begin - - //Save PlayerNames - for I := 0 to PartySession.Teams.NumTeams-1 do - begin - PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); - for J := 0 to PartySession.Teams.Teaminfo[I].NumPlayers-1 do - begin - PartySession.Teams.Teaminfo[I].Playerinfo[J].Name := PChar(Button[I*5 + J+1].Text[0].Text); - PartySession.Teams.Teaminfo[I].Playerinfo[J].TimesPlayed := 0; - end; - end; - - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyNewRound); - end; + SDLK_RETURN: UpdateParty; // Up and Down could be done at the same time, // but I don't want to declare variables inside // functions like this one, called so many times SDLK_DOWN: IntNext; SDLK_UP: IntPrev; - SDLK_RIGHT: IntNext; - SDLK_LEFT: IntPrev; + SDLK_RIGHT: begin + if (Interaction in [0,2,8,14]) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + + UpdateInterface; + end; + end; + SDLK_LEFT: begin + if (Interaction in [0,2,8,14]) then + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + + UpdateInterface; + end; + end; end; end; end; @@ -279,25 +359,47 @@ begin LoadFromTheme(Theme.PartyPlayer); + Theme.PartyPlayer.SelectTeams.oneItemOnly := true; + Theme.PartyPlayer.SelectTeams.showArrows := true; + SelectTeams := AddSelectSlide(Theme.PartyPlayer.SelectTeams, CountTeams, ITeams); + Team1Name := AddButton(Theme.PartyPlayer.Team1Name); + Theme.PartyPlayer.SelectPlayers1.oneItemOnly := true; + Theme.PartyPlayer.SelectPlayers1.showArrows := true; + SelectPlayers[0] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers1, CountPlayer[0], IPlayers); + AddButton(Theme.PartyPlayer.Player1Name); AddButton(Theme.PartyPlayer.Player2Name); AddButton(Theme.PartyPlayer.Player3Name); AddButton(Theme.PartyPlayer.Player4Name); Team2Name := AddButton(Theme.PartyPlayer.Team2Name); + Theme.PartyPlayer.SelectPlayers2.oneItemOnly := true; + Theme.PartyPlayer.SelectPlayers2.showArrows := true; + SelectPlayers[1] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers2, CountPlayer[1], IPlayers); + AddButton(Theme.PartyPlayer.Player5Name); AddButton(Theme.PartyPlayer.Player6Name); AddButton(Theme.PartyPlayer.Player7Name); AddButton(Theme.PartyPlayer.Player8Name); Team3Name := AddButton(Theme.PartyPlayer.Team3Name); + Theme.PartyPlayer.SelectPlayers3.oneItemOnly := true; + Theme.PartyPlayer.SelectPlayers3.showArrows := true; + SelectPlayers[2] := AddSelectSlide(Theme.PartyPlayer.SelectPlayers3, CountPlayer[2], IPlayers); + AddButton(Theme.PartyPlayer.Player9Name); AddButton(Theme.PartyPlayer.Player10Name); AddButton(Theme.PartyPlayer.Player11Name); AddButton(Theme.PartyPlayer.Player12Name); Interaction := 0; + + //Clear Selects + CountTeams := 0; + CountPlayer[0] := 0; + CountPlayer[1] := 0; + CountPlayer[2] := 0; end; procedure TScreenPartyPlayer.OnShow; @@ -320,66 +422,18 @@ begin Button[5].Text[0].Text := Ini.NameTeam[1]; Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - - if (PartySession.Teams.NumTeams>=1) then - begin - Button[0].Visible := true; - Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); - Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); - Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); - Button[4].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=4); - end - else - begin - Button[0].Visible := false; - Button[1].Visible := false; - Button[2].Visible := false; - Button[3].Visible := false; - Button[4].Visible := false; - end; - if (PartySession.Teams.NumTeams>=2) then - begin - Button[5].Visible := true; - Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); - Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); - Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); - Button[9].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=4); - end - else - begin - Button[5].Visible := false; - Button[6].Visible := false; - Button[7].Visible := false; - Button[8].Visible := false; - Button[9].Visible := false; - end; - - if (PartySession.Teams.NumTeams>=3) then - begin - Button[10].Visible := true; - Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); - Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); - Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); - Button[14].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=4); - end - else - begin - Button[10].Visible := false; - Button[11].Visible := false; - Button[12].Visible := false; - Button[13].Visible := false; - Button[14].Visible := false; - end; + Party.Clear; + UpdateInterface; end; procedure TScreenPartyPlayer.SetAnimationProgress(Progress: real); var I: integer; begin - for I := 0 to high(Button) do - Button[I].Texture.ScaleW := Progress; + {for I := 0 to high(Button) do + Button[I].Texture.ScaleW := Progress; } end; end. diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas new file mode 100644 index 00000000..146b8beb --- /dev/null +++ b/src/screens/UScreenPartyRounds.pas @@ -0,0 +1,237 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL: https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/branches/experimental/Lua/src/screens/UScreenPartyOptions.pas $ + * $Id: UScreenPartyOptions.pas 2036 2009-12-14 20:59:44Z whiteshark0 $ + *} + +unit UScreenPartyRounds; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + UMenu, + SDL, + UDisplay, + UMusic, + UFiles, + SysUtils, + UThemes; + +type + TScreenPartyRounds = class(TMenu) + private + SelectRoundCount: cardinal; + SelectRound: array [0..6] of cardinal; + + RoundCount: integer; + Round: array [0..6] of integer; + + IModeNames: array of UTF8String; + IModeIDs: array of integer; + + procedure UpdateInterface; + procedure StartParty; + public + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + procedure OnShow; override; + procedure SetAnimationProgress(Progress: real); override; + end; + +const + IRoundCount: array[0..5] of UTF8String = ('2', '3', '4', '5', '6', '7'); + +implementation + +uses + UGraphic, + UMain, + UIni, + UTexture, + ULanguage, + UParty, + USong, + UDLLManager, + UPlaylist, + USongs, + UUnicodeUtils; + +procedure TScreenPartyRounds.UpdateInterface; + var + I: integer; + ActualRounds: integer; +begin + ActualRounds := RoundCount + 2; + + for I := 0 to High(SelectRound) do + SelectsS[SelectRound[I]].Visible := (I < ActualRounds); +end; + +procedure TScreenPartyRounds.StartParty; + var + GameRounds: ARounds; + I: integer; +begin + SetLength(GameRounds, RoundCount + 2); + + for I := 0 to High(GameRounds) do + GameRounds[I] := IModeIds[Round[I]]; + + // start party game + if (Party.StartGame(GameRounds)) then + begin + FadeTo(@ScreenPartyNewRound, SoundLib.Start); + end + else + begin + //error starting party game + ScreenPopupError.ShowPopup(Language.Translate('ERROR_CAN_NOT_START_PARTY')); + end; +end; + +function TScreenPartyRounds.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +var + I, J: integer; + OnlyMultiPlayer: boolean; +begin + Result := true; + if (PressedDown) then + begin // Key Down + // check normal keys + case UCS4UpperCase(CharCode) of + Ord('Q'): + begin + Result := false; + Exit; + end; + end; + + // check special keys + case PressedKey of + SDLK_ESCAPE, + SDLK_BACKSPACE : + begin + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenPartyPlayer); + end; + + SDLK_RETURN: StartParty; + + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: InteractNext; + SDLK_UP: InteractPrev; + SDLK_RIGHT: + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractInc; + + if Interaction = 0 then + UpdateInterface; + end; + SDLK_LEFT: + begin + AudioPlayback.PlaySound(SoundLib.Option); + InteractDec; + + if Interaction = 0 then + UpdateInterface; + end; + end; + end; +end; + +constructor TScreenPartyRounds.Create; + var + I: integer; +begin + inherited Create; + RoundCount := 5; + + //Load Screen From Theme + LoadFromTheme(Theme.PartyRounds); + + Theme.PartyRounds.SelectRoundCount.oneItemOnly := true; + Theme.PartyRounds.SelectRoundCount.showArrows := true; + SelectRoundCount := AddSelectSlide(Theme.PartyRounds.SelectRoundCount, RoundCount, IRoundCount); + + SetLength(IModeNames, 1); + IModeNames[0] := '---'; + for I := 0 to high(Theme.PartyRounds.SelectRound) do + begin + Round[I] := 0; + Theme.PartyRounds.SelectRound[I].oneItemOnly := true; + Theme.PartyRounds.SelectRound[I].showArrows := true; + SelectRound[I] := AddSelectSlide(Theme.PartyRounds.SelectRound[I], Round[I], IModeNames); + end; + + + Interaction := 0; +end; + +procedure TScreenPartyRounds.OnShow; + var + ModeList: AParty_ModeList; + I: integer; +begin + inherited; + + // check if there are loaded modes + if Party.ModesAvailable then + begin + UpdateInterface; + + ModeList := Party.GetAvailableModes; + SetLength(IModeNames, Length(ModeList)); + SetLength(IModeIds, Length(ModeList)); + for I := 0 to High(ModeList) do + begin + IModeNames[I] := ModeList[I].Name; + IModeIds[I] := ModeList[I].Index; + end; + + for I := 0 to High(SelectRound) do + UpdateSelectSlideOptions(Theme.PartyRounds.SelectRound[I] , SelectRound[I], IModeNames, Round[I]); + end + else + begin + // no mode available for current player setup + ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_MODES_FOR_CURRENT_SETUP')); + Party.Clear; + Display.AbortScreenChange; + end; +end; + +procedure TScreenPartyRounds.SetAnimationProgress(Progress: real); +begin + {for I := 0 to 6 do + SelectS[I].Texture.ScaleW := Progress;} +end; + +end. diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 2de240b8..e2d4814b 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -103,26 +103,22 @@ begin // check special keys case PressedKey of SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_BACKSPACE, + SDLK_RETURN : begin AudioPlayback.PlaySound(SoundLib.Start); - if (PartySession.CurRound < High(PartySession.Rounds)) then - FadeTo(@ScreenPartyNewRound) + + Party.NextRound; //< go to next round + + if (not Party.GameFinished) then + begin + FadeTo(@ScreenPartyNewRound); + end else begin - PartySession.EndRound; FadeTo(@ScreenPartyWin); end; end; - - SDLK_RETURN: - begin - AudioPlayback.PlaySound(SoundLib.Start); - if (PartySession.CurRound < High(PartySession.Rounds)) then - FadeTo(@ScreenPartyNewRound) - else - FadeTo(@ScreenPartyWin); - end; end; end; end; @@ -204,29 +200,18 @@ end; procedure TScreenPartyScore.OnShow; var I, J: integer; - Placings: array [0..5] of byte; + Ranking: AParty_TeamRanking; begin inherited; - //Get Maxscore + // indicate that round is finished + Party.RoundPlayed; - MaxScore := 0; - for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do - begin - if (ScreenSingModi.PlayerInfo.Playerinfo[I].Score > MaxScore) then - MaxScore := ScreenSingModi.PlayerInfo.Playerinfo[I].Score; - end; + // get rankings for current round + Ranking := Party.Rounds[Party.CurrentRound].Ranking; - //Get Placings - for I := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do - begin - Placings[I] := 0; - for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do - if (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then - Inc(Placings[I]); - end; - //Set Static Length + {//Set Static Length Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; @@ -234,26 +219,26 @@ begin //fix: prevents static from drawn out of bounds. if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99; if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; - if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; - - //End Last Round - PartySession.EndRound; + if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; } //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(Party.CurrentRound)]); - if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + if (Length(Party.Teams) >= 1) then begin - Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); - Text[TextNameTeam1].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + Text[TextScoreTeam1].Text := InttoStr(Party.Teams[0].Score); + Text[TextNameTeam1].Text := Utf8String(Party.Teams[0].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then begin - Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Placings[0]]; - Static[StaticTeam1Deco].Texture.ColR := DecoColor[Placings[0]].R; - Static[StaticTeam1Deco].Texture.ColG := DecoColor[Placings[0]].G; - Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; + if (Length(Ranking) >= 1) and (Ranking[0].Rank >= 1) and (Ranking[0].Rank <= Length(DecoTex)) then + begin + Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Ranking[0].Rank-1]; + Static[StaticTeam1Deco].Texture.ColR := DecoColor[Ranking[0].Rank-1].R; + Static[StaticTeam1Deco].Texture.ColG := DecoColor[Ranking[0].Rank-1].G; + Static[StaticTeam1Deco].Texture.ColB := DecoColor[Ranking[0].Rank-1].B; + end; end; Text[TextScoreTeam1].Visible := true; @@ -271,18 +256,21 @@ begin Static[StaticTeam1Deco].Visible := false; end; - if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then + if (Length(Party.Teams) >= 2) then begin - Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); - Text[TextNameTeam2].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + Text[TextScoreTeam2].Text := InttoStr(Party.Teams[1].Score); + Text[TextNameTeam2].Text := UTF8String(Party.Teams[1].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then begin - Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Placings[1]]; - Static[StaticTeam2Deco].Texture.ColR := DecoColor[Placings[1]].R; - Static[StaticTeam2Deco].Texture.ColG := DecoColor[Placings[1]].G; - Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; + if (Length(Ranking) >= 2) and (Ranking[1].Rank >= 1) and (Ranking[1].Rank <= Length(DecoTex)) then + begin + Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Ranking[1].Rank-1]; + Static[StaticTeam2Deco].Texture.ColR := DecoColor[Ranking[1].Rank-1].R; + Static[StaticTeam2Deco].Texture.ColG := DecoColor[Ranking[1].Rank-1].G; + Static[StaticTeam2Deco].Texture.ColB := DecoColor[Ranking[1].Rank-1].B; + end; end; Text[TextScoreTeam2].Visible := true; @@ -300,18 +288,21 @@ begin Static[StaticTeam2Deco].Visible := false; end; - if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then + if (Length(Party.Teams) >= 3) then begin - Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); - Text[TextNameTeam3].Text := UTF8String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + Text[TextScoreTeam3].Text := InttoStr(Party.Teams[2].Score); + Text[TextNameTeam3].Text := UTF8String(Party.Teams[2].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then begin - Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Placings[2]]; - Static[StaticTeam3Deco].Texture.ColR := DecoColor[Placings[2]].R; - Static[StaticTeam3Deco].Texture.ColG := DecoColor[Placings[2]].G; - Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; + if (Length(Ranking) >= 3) and (Ranking[2].Rank >= 1) and (Ranking[2].Rank <= Length(DecoTex)) then + begin + Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Ranking[2].Rank-1]; + Static[StaticTeam3Deco].Texture.ColR := DecoColor[Ranking[2].Rank-1].R; + Static[StaticTeam3Deco].Texture.ColG := DecoColor[Ranking[2].Rank-1].G; + Static[StaticTeam3Deco].Texture.ColB := DecoColor[Ranking[2].Rank-1].B; + end; end; Text[TextScoreTeam3].Visible := true; @@ -332,12 +323,12 @@ end; procedure TScreenPartyScore.SetAnimationProgress(Progress: real); begin - if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then + {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then - Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;} end; end. diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index afa5ce83..18a6e69e 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -94,13 +94,8 @@ begin // check special keys case PressedKey of SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenMain); - end; - - SDLK_RETURN: + SDLK_BACKSPACE, + SDLK_RETURN : begin AudioPlayback.PlaySound(SoundLib.Start); FadeTo(@ScreenMain); @@ -139,10 +134,10 @@ end; procedure TScreenPartyWin.OnShow; var - I: integer; - Placing: TeamOrderArray; + I, J: integer; + Ranking: AParty_TeamRanking; - Function GetTeamColor(Team: byte): cardinal; + Function GetTeamColor(Team: integer): cardinal; var NameString: string; begin @@ -154,15 +149,16 @@ var begin inherited; - //Get Team Placing - Placing := PartySession.GetTeamOrder; + // get team ranking + // Ranking is sorted by score + Ranking := Party.GetTeamRanking; //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); - if (PartySession.Teams.NumTeams >= 1) then + Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(-1)]); + if (Length(Party.Teams) >= 1) then begin - Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); - Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[Placing[0]].Name); + Text[TextScoreTeam1].Text := IntToStr(Party.Teams[Ranking[0].Team].Score); + Text[TextNameTeam1].Text := Party.Teams[Ranking[0].Team].Name; Text[TextScoreTeam1].Visible := true; Text[TextNameTeam1].Visible := true; @@ -173,7 +169,7 @@ begin //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[0]); + I := GetTeamColor(Ranking[0].Team); if (I <> -1) then begin Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; @@ -184,7 +180,7 @@ begin if (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[0]); + I := GetTeamColor(Ranking[0].Team); if (I <> -1) then begin Static[StaticTeam1].Texture.ColR := Color[I].RGB.R; @@ -202,10 +198,10 @@ begin Static[StaticTeam1Deco].Visible := false; end; - if (PartySession.Teams.NumTeams >= 2) then + if (Length(Party.Teams) >= 2) then begin - Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); - Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[Placing[1]].Name); + Text[TextScoreTeam2].Text := IntToStr(Party.Teams[Ranking[1].Team].Score); + Text[TextNameTeam2].Text := Party.Teams[Ranking[1].Team].Name; Text[TextScoreTeam2].Visible := true; Text[TextNameTeam2].Visible := true; @@ -216,7 +212,7 @@ begin //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[1]); + I := GetTeamColor(Ranking[1].Team); if (I <> -1) then begin Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; @@ -227,7 +223,7 @@ begin if (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[1]); + I := GetTeamColor(Ranking[1].Team); if (I <> -1) then begin Static[StaticTeam2].Texture.ColR := Color[I].RGB.R; @@ -245,10 +241,10 @@ begin Static[StaticTeam2Deco].Visible := false; end; - if (PartySession.Teams.NumTeams >= 3) then + if (Length(Party.Teams) >= 3) then begin - Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); - Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[Placing[2]].Name); + Text[TextScoreTeam3].Text := IntToStr(Party.Teams[Ranking[2].Team].Score); + Text[TextNameTeam3].Text := Party.Teams[Ranking[2].Team].Name; Text[TextScoreTeam3].Visible := true; Text[TextNameTeam3].Visible := true; @@ -259,7 +255,7 @@ begin //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[2]); + I := GetTeamColor(Ranking[2].Team); if (I <> -1) then begin Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; @@ -270,7 +266,7 @@ begin if (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then begin - I := GetTeamColor(Placing[2]); + I := GetTeamColor(Ranking[2].Team); if (I <> -1) then begin Static[StaticTeam3].Texture.ColR := Color[I].RGB.R; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 20f3b15e..18496517 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -50,7 +50,8 @@ uses UTexture, UThemes, UPath, - UTime; + UTime, + UHookableEvent; type TLyricsSyncSource = class(TSyncSource) @@ -61,7 +62,9 @@ type TScreenSing = class(TMenu) protected VideoLoaded: boolean; - Paused: boolean; // pause mod + eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow + protected + Paused: boolean; //pause Mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public @@ -104,6 +107,19 @@ type fShowVisualization: boolean; fCurrentVideoPlaybackEngine: IVideoPlayback; + // some settings to be set by plugins + settings: record + Finish: Boolean; //< if true, screen will finish on next draw + + LyricsVisible: Boolean; //< shows or hides lyrics + NotesVisible: Integer; //< if bit[playernum] is set the notes for the specified player are visible. By default all players notes are visible + + PlayerEnabled: Integer; //< defines whether a player can score atm + end; + procedure ClearSettings; + procedure ApplySettings; //< applies changes of settings record + procedure EndSong; + constructor Create; override; procedure OnShow; override; procedure OnShowFinish; override; @@ -132,6 +148,7 @@ uses URecord, USong, UDisplay, + UParty, UUnicodeUtils; // method for input parsing. if false is returned, getnextwindow @@ -312,6 +329,10 @@ begin Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); LyricsSync := TLyricsSyncSource.Create(); + + eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); + + ClearSettings; end; procedure TScreenSing.OnShow; @@ -334,8 +355,10 @@ begin //the song was sung to the end SungToEnd := false; + ClearSettings; + Party.CallBeforeSing; - // reset video playback engine, to play video clip ... + // reset video playback engine, to play Video Clip... fCurrentVideoPlaybackEngine := VideoPlayback; // setup score manager @@ -443,8 +466,8 @@ begin if (not success) then begin - // error loading song -> go back to song screen and show some error message - FadeTo(@ScreenSong); + // error loading song -> go back to previous screen and show some error message + Display.AbortScreenChange; // select new song in party mode if ScreenSong.Mode = smPartyMode then ScreenSong.SelectRandomSong(); @@ -635,6 +658,8 @@ begin if Lines[0].Line[Index].TotalNotes = 0 then Inc(NumEmptySentences); + eSongLoaded.CallHookChain(False); + Log.LogStatus('End', 'OnShow'); end; @@ -653,6 +678,25 @@ begin CountSkipTimeSet; end; +procedure TScreenSing.ClearSettings; +begin + Settings.Finish := False; + Settings.LyricsVisible := True; + Settings.NotesVisible := high(Integer); + Settings.PlayerEnabled := high(Integer); +end; + +{ applies changes of settings record } +procedure TScreenSing.ApplySettings; +begin + // +end; + +procedure TScreenSing.EndSong; +begin + Settings.Finish := True; +end; + procedure TScreenSing.OnHide; begin // background texture @@ -790,11 +834,14 @@ begin if ShowFinish then begin if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or - (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) then + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then begin // analyze song if not paused if (not Paused) then + begin Sing(Self); + Party.CallOnSing; + end; end else begin @@ -802,7 +849,6 @@ begin begin Finish; FadeOut := true; - FadeTo(@ScreenScore); end; end; end; @@ -879,6 +925,8 @@ begin end; SetFontItalic(false); + + Party.CallAfterSing; end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a2760ae3..5bc42a68 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -145,7 +145,7 @@ type //procedures for Menu procedure StartSong; procedure OpenEditor; - procedure DoJoker(Team: byte); + procedure DoJoker(Team: integer); procedure SelectPlayers; procedure UnloadDetailedCover; @@ -602,7 +602,7 @@ begin if (Ini.PartyPopup = 1) then ScreenSongMenu.MenuShow(SM_Party_Main) else - ScreenSong.StartSong; + Party.CallAfterSongSelect; end; end; end; @@ -717,35 +717,17 @@ begin SDLK_1: begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then - begin - //Use Joker - Dec(PartySession.Teams.Teaminfo[0].Joker); - SelectRandomSong; - SetJoker; - end; + DoJoker(0); end; SDLK_2: begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then - begin - //Use Joker - Dec(PartySession.Teams.Teaminfo[1].Joker); - SelectRandomSong; - SetJoker; - end; + DoJoker(1); end; SDLK_3: begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then - begin - //Use Joker - Dec(PartySession.Teams.Teaminfo[2].Joker); - SelectRandomSong; - SetJoker; - end; + DoJoker(2); end; end; end; // if (PressedDown) @@ -1555,8 +1537,8 @@ begin AudioPlayback.SetVolume(1.0); // if hide then stop music (for party mode popup on exit) - if (Display.NextScreen <> @ScreenSing) and - (Display.NextScreen <> @ScreenSingModi) then + if (Display.NextScreen <> @ScreenSing) {and + (Display.NextScreen <> @ScreenSingModi) }then begin StopMusicPreview(); end; @@ -1883,13 +1865,13 @@ begin // If Party Mode if Mode = smPartyMode then //Show Joker that are available begin - if (PartySession.Teams.NumTeams >= 1) then + if (Length(Party.Teams) >= 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); + Static[StaticTeam1Joker1].Visible := (Party.Teams[0].JokersLeft >= 1); + Static[StaticTeam1Joker2].Visible := (Party.Teams[0].JokersLeft >= 2); + Static[StaticTeam1Joker3].Visible := (Party.Teams[0].JokersLeft >= 3); + Static[StaticTeam1Joker4].Visible := (Party.Teams[0].JokersLeft >= 4); + Static[StaticTeam1Joker5].Visible := (Party.Teams[0].JokersLeft >= 5); end else begin @@ -1900,13 +1882,13 @@ begin Static[StaticTeam1Joker5].Visible := false; end; - if (PartySession.Teams.NumTeams >= 2) then + if (Length(Party.Teams) >= 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); + Static[StaticTeam2Joker1].Visible := (Party.Teams[1].JokersLeft >= 1); + Static[StaticTeam2Joker2].Visible := (Party.Teams[1].JokersLeft >= 2); + Static[StaticTeam2Joker3].Visible := (Party.Teams[1].JokersLeft >= 3); + Static[StaticTeam2Joker4].Visible := (Party.Teams[1].JokersLeft >= 4); + Static[StaticTeam2Joker5].Visible := (Party.Teams[1].JokersLeft >= 5); end else begin @@ -1917,13 +1899,13 @@ begin Static[StaticTeam2Joker5].Visible := false; end; - if (PartySession.Teams.NumTeams >= 3) then + if (Length(Party.Teams) >= 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); + Static[StaticTeam3Joker1].Visible := (Party.Teams[2].JokersLeft >= 1); + Static[StaticTeam3Joker2].Visible := (Party.Teams[2].JokersLeft >= 2); + Static[StaticTeam3Joker3].Visible := (Party.Teams[2].JokersLeft >= 3); + Static[StaticTeam3Joker4].Visible := (Party.Teams[2].JokersLeft >= 4); + Static[StaticTeam3Joker5].Visible := (Party.Teams[2].JokersLeft >= 5); end else begin @@ -1990,7 +1972,7 @@ begin //Party Mode if (Mode = smPartyMode) then begin - FadeTo(@ScreenSingModi); + FadeTo(@ScreenSing); end else begin @@ -2021,14 +2003,14 @@ begin end; //Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: byte); +procedure TScreenSong.DoJoker (Team: integer); begin if (Mode = smPartyMode) and - (PartySession.Teams.NumTeams >= Team + 1) and - (PartySession.Teams.Teaminfo[Team].Joker > 0) then + (High(Party.Teams) >= Team) and + (Party.Teams[Team].JokersLeft > 0) then begin //Use Joker - Dec(PartySession.Teams.Teaminfo[Team].Joker); + Dec(Party.Teams[Team].JokersLeft); SelectRandomSong; SetJoker; end; diff --git a/src/screens/UScreenSongMenu.pas b/src/screens/UScreenSongMenu.pas index ec893c7a..173ac2c8 100644 --- a/src/screens/UScreenSongMenu.pas +++ b/src/screens/UScreenSongMenu.pas @@ -401,16 +401,19 @@ begin begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0); - 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 := UTF8String(PartySession.Teams.Teaminfo[0].Name); - Button[1].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := UTF8String(PartySession.Teams.Teaminfo[2].Name); + // to-do : Party + Button[0].Visible := (Length(Party.Teams) >= 1) AND (Party.Teams[0].JokersLeft > 0); + Button[1].Visible := (Length(Party.Teams) >= 2) AND (Party.Teams[1].JokersLeft > 0); + Button[2].Visible := (Length(Party.Teams) >= 3) AND (Party.Teams[2].JokersLeft > 0); + Button[3].Visible := True; + SelectsS[0].Visible := False; + + if (Button[0].Visible) then + Button[0].Text[0].Text := UTF8String(Party.Teams[0].Name); + if (Button[1].Visible) then + Button[1].Text[0].Text := UTF8String(Party.Teams[1].Name); + if (Button[2].Visible) then + Button[2].Text[0].Text := UTF8String(Party.Teams[2].Name); Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); // set right interaction @@ -614,7 +617,7 @@ begin 0: // button 1 begin // start singing - ScreenSong.StartSong; + Party.CallAfterSongSelect; Visible := false; end; -- cgit v1.2.3 From f29685523465fb0d2d0d6bbe9985cf11207cde23 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 12 Jan 2010 19:55:25 +0000 Subject: deleted leftovers from old plugin system and party mode git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2080 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 3 +- src/screens/UScreenPartyNewRound.pas | 1 - src/screens/UScreenPartyOptions.pas | 1 - src/screens/UScreenPartyRounds.pas | 1 - src/screens/UScreenSingModi.pas | 582 ----------------------------------- src/screens/UScreenSong.pas | 1 - 6 files changed, 1 insertion(+), 588 deletions(-) delete mode 100644 src/screens/UScreenSingModi.pas (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index b342281c..8bdfe419 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -67,7 +67,6 @@ uses Textgl, ULanguage, UParty, - UDLLManager, UScreenCredits, USkins, UUnicodeUtils; @@ -98,7 +97,7 @@ begin end; end; Ord('M'): begin - if (Ini.Players >= 1) and (Length(DLLMan.Plugins) >= 1) then + if (Ini.Players >= 1) and (Party.ModesAvailable) then begin FadeTo(@ScreenPartyOptions, SoundLib.Start); Exit; diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index b52efd21..6a1c8e69 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -94,7 +94,6 @@ uses UIni, UTexture, UParty, - UDLLManager, ULanguage, USong, ULog, diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 3dce9954..998d3655 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -74,7 +74,6 @@ uses ULanguage, UParty, USong, - UDLLManager, UPlaylist, USongs, UUnicodeUtils; diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas index 146b8beb..5211e32c 100644 --- a/src/screens/UScreenPartyRounds.pas +++ b/src/screens/UScreenPartyRounds.pas @@ -76,7 +76,6 @@ uses ULanguage, UParty, USong, - UDLLManager, UPlaylist, USongs, UUnicodeUtils; diff --git a/src/screens/UScreenSingModi.pas b/src/screens/UScreenSingModi.pas deleted file mode 100644 index 48d1e9a1..00000000 --- a/src/screens/UScreenSingModi.pas +++ /dev/null @@ -1,582 +0,0 @@ -{* UltraStar Deluxe - Karaoke Game - * - * UltraStar Deluxe is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - *} - -unit UScreenSingModi; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - gl, - UPath, - UThemes, - UScreenSing, - ModiSDK; - -type - TScreenSingModi = class(TScreenSing) - protected - - public - Winner: byte; //Who Wins - PlayerInfo: TPlayerInfo; - TeamInfo: TTeamInfo; - - constructor Create; override; - procedure OnShow; override; - //procedure onShowFinish; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function Draw: boolean; override; - procedure Finish; override; - end; - -type - TCustomSoundEntry = record - Filename : IPath; - Stream : TAudioPlaybackStream; - end; - -var - //Custom Sounds - CustomSounds: array of TCustomSoundEntry; - -//Procedured for Plugin -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//function Translate (const Name: PChar): PChar; -// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} - -//Utilys -function ToSentences(Const Lines: TLines): TSentences; - -implementation - -uses - Classes, - Math, - UDLLManager, - UDraw, - UGraphic, - UGraphicClasses, - ULanguage, - UNote, - UPathUtils, - URecord, - USkins; - -// Method for input parsing. If false is returned, GetNextWindow -// should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; -begin - Result := true; - if (PressedDown) then - begin // Key Down - case PressedKey of - - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Finish; - AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenPartyScore); - end; - - else - Result := inherited ParseInput(PressedKey, CharCode, PressedDown); - end; - end; -end; - -constructor TScreenSingModi.Create; -begin - inherited Create; - -end; - -function ToSentences(Const Lines: TLines): TSentences; -var - I, J: integer; -begin - Result.Current := Lines.Current; - Result.High := Lines.High; - Result.Number := Lines.Number; - Result.Resolution := Lines.Resolution; - Result.NotesGAP := Lines.NotesGAP; - Result.TotalLength := Lines.ScoreValue; - - SetLength(Result.Sentence, Length(Lines.Line)); - for I := low(Result.Sentence) to high(Result.Sentence) do - begin - Result.Sentence[I].Start := Lines.Line[I].Start; - Result.Sentence[I].StartNote := Lines.Line[I].Note[0].Start; - Result.Sentence[I].Lyric := Lines.Line[I].Lyric; - Result.Sentence[I].End_ := Lines.Line[I].End_; - Result.Sentence[I].BaseNote := Lines.Line[I].BaseNote; - Result.Sentence[I].HighNote := Lines.Line[I].HighNote; - Result.Sentence[I].TotalNotes := Lines.Line[I].TotalNotes; - - SetLength(Result.Sentence[I].Note, Length(Lines.Line[I].Note)); - for J := low(Result.Sentence[I].Note) to high(Result.Sentence[I].Note) do - begin - Result.Sentence[I].Note[J].Color := Lines.Line[I].Note[J].Color; - Result.Sentence[I].Note[J].Start := Lines.Line[I].Note[J].Start; - Result.Sentence[I].Note[J].Length := Lines.Line[I].Note[J].Length; - Result.Sentence[I].Note[J].Tone := Lines.Line[I].Note[J].Tone; - //Result.Sentence[I].Note[J].Text := Lines.Line[I].Note[J].Text; - Result.Sentence[I].Note[J].FreeStyle := (Lines.Line[I].Note[J].NoteType = ntFreestyle); - end; - end; -end; - -procedure TScreenSingModi.OnShow; -var - I: integer; -begin - inherited; - - PlayersPlay := TeamInfo.NumTeams; - - if DLLMan.Selected.LoadSong then //Start with Song - begin - inherited; - end - else //Start Without Song - begin - AudioInput.CaptureStart; - end; - -//Set Playerinfo - PlayerInfo.NumPlayers := PlayersPlay; - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); - PlayerInfo.Playerinfo[I].Score := 0; - PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := true; - end; - - for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do - begin - PlayerInfo.Playerinfo[I].Score:= 0; - PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := false; - end; - - {Case PlayersPlay of - 1: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ScoreBG].Texture.Y + Static[StaticP1ScoreBG].Texture.H; - end; - 2,4: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP1TwoPScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP1TwoPScoreBG].Texture.Y + Static[StaticP1TwoPScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP2RScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP2RScoreBG].Texture.Y + Static[StaticP2RScoreBG].Texture.H; - end; - 3,6: begin - PlayerInfo.Playerinfo[0].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[0].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[3].PosX := Static[StaticP1ThreePScoreBG].Texture.X; - PlayerInfo.Playerinfo[3].PosY := Static[StaticP1ThreePScoreBG].Texture.Y + Static[StaticP1ThreePScoreBG].Texture.H; - PlayerInfo.Playerinfo[1].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[1].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[4].PosX := Static[StaticP2MScoreBG].Texture.X; - PlayerInfo.Playerinfo[4].PosY := Static[StaticP2MScoreBG].Texture.Y + Static[StaticP2MScoreBG].Texture.H; - PlayerInfo.Playerinfo[2].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[2].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - PlayerInfo.Playerinfo[5].PosX := Static[StaticP3RScoreBG].Texture.X; - PlayerInfo.Playerinfo[5].PosY := Static[StaticP3RScoreBG].Texture.Y + Static[StaticP3RScoreBG].Texture.H; - end; - end; } - - // play music (I) - //Music.CaptureStart; - //Music.MoveTo(AktSong.Start); - - //Init Plugin - if not DLLMan.PluginInit(TeamInfo, PlayerInfo, ToSentences(Lines[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 - Scores.Visible := DLLMan.Selected.ShowScore; - - {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; - TextStr: string; - S, I: integer; - T: integer; - CurLyricsTime: real; -begin - Result := false; - - //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].ScoreTotalInt <= MAX_SONG_SCORE) then - PlayerInfo.Playerinfo[I].Score:= Player[I].ScoreTotalInt; - PlayerInfo.Playerinfo[I].Bar := Round(Scores.Players[I].RBPos * 100); - end; - end; - - Background.Draw; - - // draw background picture (if any, and if no visualizations) - // when we don't check for visualizations the visualizations would - // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer - if (DllMan.Selected.LoadSong) and (DllMan.Selected.LoadBack) and (not fShowVisualization) then - SingDrawBackground; - - // 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 - - Else if ScreenAct = 2 then - begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if - - // stereo <- and where iss P2M? or P3? - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; - Text[TextP1].X := Text[TextP1].X + 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; - - 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 ... - CurLyricsTime := LyricsState.GetCurrentTime(); - Min := Round(CurLyricsTime) div 60; - Sec := Round(CurLyricsTime) 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; - - // update and draw movie -{ if ShowFinish and CurrentSong.VideoLoaded and DllMan.Selected.LoadVideo then - begin - UpdateSmpeg; // this only draws - end;} - - // update and draw movie - if (ShowFinish and (VideoLoaded or fShowVisualization) and DllMan.Selected.LoadVideo) then - begin - if assigned(fCurrentVideoPlaybackEngine) then - begin - // Just call this once - // when Screens = 2 - if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); - end; - end; - - // draw static menu (FG) - DrawFG; - - if ShowFinish then - begin - if DllMan.Selected.LoadSong then - begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.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 - - //Draw Score - Scores.Draw; - - //Update PlayerInfo - for I := 0 to PlayerInfo.NumPlayers-1 do - begin - if PlayerInfo.Playerinfo[I].Enabled then - begin - //PlayerInfo.Playerinfo[I].Bar := Player[I].ScorePercent; - PlayerInfo.Playerinfo[I].Score := Player[I].ScoreTotalInt; - end; - end; - - if ((ShowFinish) and (not Paused)) then - begin - if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) 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].ScoreTotalInt <> PlayerInfo.Playerinfo[I].Score) then - begin - //Player[I].ScoreTotal := Player[I].ScoreTotal + (PlayerInfo.Playerinfo[I].Score - Player[I].ScoreTotalI); - Player[I].ScoreTotalInt := PlayerInfo.Playerinfo[I].Score; - end; - {if (PlayerInfo.Playerinfo[I].Bar <> Player[I].ScorePercent) then - Player[I].ScorePercentTarget := PlayerInfo.Playerinfo[I].Bar; } - end; - - // back stereo - Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10*ScreenX; - Text[TextP1].X := Text[TextP1].X - 10*ScreenX; - - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} - - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; - - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} - - for S := 1 to 1 do - Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10*ScreenX; - - Result := true; -end; - -procedure TScreenSingModi.Finish; -begin -inherited Finish; - -Winner := DllMan.PluginFinish(PlayerInfo); - -//Log.LogError('Winner: ' + InttoStr(Winner)); - -//DLLMan.UnLoadPlugin; -end; - -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; -var - TexName: IPath; - Ext: UTF8String; - Tex: TTexture; -begin - //Get texture Name - TexName := Skin.GetTextureFileName(string(Name)); - //Get File Typ - Ext := TexName.GetExtension().ToUTF8; - if (UpperCase(Ext) = '.JPG') then - Ext := 'JPG' - else - Ext := 'BMP'; - - Tex := Texture.LoadTexture(false, TexName, UTexture.TTextureType(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 to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); -begin - SetFontItalic ((Style and 128) = 128); - SetFontStyle(Style and 7); - // FIXME: FONTSIZE - // used by Hold_The_Line / TeamDuell - SetFontSize(Size); - SetFontPos (X, Y); - glPrint (Language.Translate(string(Text))); -end; - -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; -var - Stream: TAudioPlaybackStream; - i: integer; - Filename: IPath; - SoundFile: IPath; -begin - //Search for Sound in already loaded Sounds - SoundFile := SoundPath.Append(Name); - for i := 0 to High(CustomSounds) do - begin - if (SoundFile.Equals(CustomSounds[i].Filename, true)) then - begin - Result := i; - Exit; - end; - end; - - Stream := AudioPlayback.OpenSound(SoundFile); - if (Stream = nil) then - begin - Result := 0; - Exit; - end; - - SetLength(CustomSounds, Length(CustomSounds)+1); - CustomSounds[High(CustomSounds)].Stream := Stream; - Result := High(CustomSounds); -end; - -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); -begin - if (Index <= High(CustomSounds)) then - AudioPlayback.PlaySound(CustomSounds[Index].Stream); -end; - -end. - diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 5bc42a68..f1fdba4d 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -160,7 +160,6 @@ uses Math, gl, UCovers, - UDLLManager, UGraphic, UMain, UMenuButton, -- cgit v1.2.3 From d94d936982cc25905ffa5e961955f502077696f6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 12 Jan 2010 19:57:53 +0000 Subject: forgotten updates from last commit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2081 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenPartyScore.pas | 1 - src/screens/UScreenPartyWin.pas | 1 - 2 files changed, 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index e2d4814b..09f92dbc 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -80,7 +80,6 @@ uses UGraphic, UMain, UParty, - UScreenSingModi, ULanguage, UTexture, USkins, diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 18a6e69e..3d7092bc 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -73,7 +73,6 @@ uses UGraphic, UMain, UParty, - UScreenSingModi, ULanguage, UUnicodeUtils; -- cgit v1.2.3 From 770496cf52eea72532f8f4d9d8c865d5bda13255 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 13 Jan 2010 01:49:23 +0000 Subject: fixed scorescrenn with players>3 other minor scorescreen fixes to-do: playercolors need to be swapped with players > 3 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2085 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 537 +++++++++++++++++++++++-------------------- 1 file changed, 286 insertions(+), 251 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index ce1b11e5..20fd0d9e 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -51,9 +51,10 @@ const EaseOut_MaxSteps: real = 10; // that's the speed of the bars (10 is fast | 100 is slower) - BarRaiseSpeed: cardinal = 0; // Time for raising the bar one step higher (in ms) + BarRaiseSpeed: cardinal = 14; // Time for raising the bar one step higher (in ms) type + TScoreBarType = (sbtScore, sbtLine, sbtGolden); TPlayerScoreScreenTexture = record // holds all colorized textures for up to 6 players //Bar textures Score_NoteBarLevel_Dark: TTexture; // Note @@ -79,11 +80,22 @@ type RateEaseValue: real; end; + { hold maps of players to the different positions } + TPlayerPositionMap = record + Position: byte; // 1..6: Position of Player; 0: no position (e.g. too little screens) + Screen: byte; // 0 - Screen 1; 1 - Screen 2 + BothScreens: boolean; // true if player is drawn on both screens + end; + APlayerPositionMap = array of TPlayerPositionMap; + TScreenScore = class(TMenu) private + { holds position and screen of players(index) + set by calling MapPlayerstoPosition() } + PlayerPositionMap: APlayerPositionMap; + BarTime: cardinal; - ArrayStartModifier: integer; - public + aPlayerScoreScreenTextures: array[1..6] of TPlayerScoreScreenTexture; aPlayerScoreScreenDatas: array[1..6] of TPlayerScoreScreenData; aPlayerScoreScreenRatings: array[1..6] of TPlayerScoreRatingPics; @@ -127,25 +139,35 @@ type TextPhrase_ActualValue: array[1..6] of integer; TextGolden_ActualValue: array[1..6] of integer; - constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; - procedure OnShow; override; - procedure OnShowFinish; override; - function Draw: boolean; override; + procedure MapPlayersToPosition; + procedure FillPlayer(Item, P: integer); + procedure FillPlayerItems(PlayerNumber: integer); - procedure EaseBarIn(PlayerNumber: integer; BarType: string); - procedure EaseScoreIn(PlayerNumber: integer; ScoreType: string); + procedure UpdateAnimation; + {**** + * helpers for bar easing + *} + procedure EaseBarIn(PlayerNumber: integer; BarType: TScoreBarType); + procedure EaseScoreIn(PlayerNumber: integer; ScoreType: TScoreBarType); - procedure FillPlayerItems(PlayerNumber: integer; ScoreType: string); + procedure DrawPlayerBars; - procedure DrawBar(BarType: string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); + procedure DrawBar(BarType: TScoreBarType; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); - //Rating Picture + {**** + * helpers for rating picture + *} procedure ShowRating(PlayerNumber: integer); function CalculateBouncing(PlayerNumber: integer): real; procedure DrawRating(PlayerNumber: integer; Rating: integer); + public + constructor Create; override; + function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; + procedure OnShow; override; + procedure OnShowFinish; override; + function Draw: boolean; override; end; implementation @@ -263,21 +285,12 @@ begin end; -procedure TScreenScore.OnShow; -var - P: integer; // player - I: integer; - V: array[1..6] of boolean; // visibility array - +procedure TScreenScore.MapPlayersToPosition; + var + ArrayStartModifier: integer; + PlayersPerScreen: integer; + I: integer; begin - -{** - * Turn backgroundmusic on - *} - SoundLib.StartBgMusic; - - inherited; - // all statics / texts are loaded at start - so that we have them all even if we change the amount of players // To show the corrects statics / text from the them, we simply modify the start of the according arrays // 1 Player -> Player[0].Score (The score for one player starts at 0) @@ -287,21 +300,116 @@ begin // 3 Player -> Player[0..5].Score // -> Statics[4..6] case PlayersPlay of - 1: ArrayStartModifier := 0; - 2, 4: ArrayStartModifier := 1; - 3, 6: ArrayStartModifier := 3; + 1: ArrayStartModifier := 1; + 2, 4: ArrayStartModifier := 2; + 3, 6: ArrayStartModifier := 4; else ArrayStartModifier := 0; //this should never happen end; + if (PlayersPlay <= 3) then + PlayersPerScreen := PlayersPlay + else + PlayersPerScreen := PlayersPlay div 2; + + SetLength(PlayerPositionMap, PlayersPlay); + + // actually map players to positions + for I := 0 to PlayersPlay - 1 do + begin + PlayerPositionMap[I].Screen := (I div PlayersPerScreen) + 1; + if (PlayerPositionMap[I].Screen > Screens) then + PlayerPositionMap[I].Position := 0 + else + PlayerPositionMap[I].Position := ArrayStartModifier + (I mod PlayersPerScreen); + PlayerPositionMap[I].BothScreens := (PlayersPlay <= 3) and (Screens > 1); + end; +end; + +procedure TScreenScore.UpdateAnimation; +var + CurrentTime: integer; + I: integer; +begin + CurrentTime := SDL_GetTicks(); + + if (ScreenAct = 1) and ((CurrentTime >= BarTime) and ShowFinish) then + begin + BarTime := CurrentTime + BarRaiseSpeed; + + // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarScore_EaseOut_Step:= BarScore_EaseOut_Step + 1 + + // PhrasenBonus + else if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1 + + // GoldenNotebonus + else if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + end; +end; + +procedure TScreenScore.DrawPlayerBars; + var + I: integer; +begin + for I := 0 to PlayersPlay-1 do + begin + if (PlayerPositionMap[I].Position > 0) and ((ScreenAct = PlayerPositionMap[I].Screen) or (PlayerPositionMap[I].BothScreens)) then + begin + if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then + begin + // Draw golden score bar # + EaseBarIn(I + 1, sbtGolden); + EaseScoreIn(I + 1, sbtGolden); + end; + + // Draw phrase score bar # + EaseBarIn(I + 1, sbtLine); + EaseScoreIn(I + 1, sbtLine); + end; + + // Draw plain score bar # + EaseBarIn(I + 1, sbtScore); + EaseScoreIn(I + 1, sbtScore); + end; + end; +end; + +procedure TScreenScore.OnShow; +var + P: integer; // player + I: integer; + V: array[1..6] of boolean; // visibility array + +begin + + {** + * Turn backgroundmusic on + *} + SoundLib.StartBgMusic; + + inherited; + + MapPlayersToPosition; + for P := 1 to PlayersPlay do begin // data - aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[P + ArrayStartModifier].Y; + aPlayerScoreScreenDatas[P].Bar_Y := Theme.Score.StaticBackLevel[PlayerPositionMap[P-1].Position].Y; // ratings aPlayerScoreScreenRatings[P].RateEaseStep := 1; aPlayerScoreScreenRatings[P].RateEaseValue := 20; + + // actual values + TextScore_ActualValue[P] := 0; + TextPhrase_ActualValue[P] := 0; + TextGolden_ActualValue[P] := 0; end; Text[TextArtist].Text := CurrentSong.Artist; @@ -380,6 +488,10 @@ begin Static[StaticLevel[P]].Visible := false; Static[StaticLevelRound[P]].Visible := false; end; + + BarScore_EaseOut_Step := 1; + BarPhrase_EaseOut_Step := 1; + BarGolden_EaseOut_Step := 1; end; procedure TScreenScore.onShowFinish; @@ -392,10 +504,6 @@ begin TextPhrase_ActualValue[index] := 0; TextGolden_ActualValue[index] := 0; end; - - BarScore_EaseOut_Step := 1; - BarPhrase_EaseOut_Step := 1; - BarGolden_EaseOut_Step := 1; end; function TScreenScore.Draw: boolean; @@ -405,7 +513,7 @@ var PStart: integer; PHigh: integer; begin -{* +//{* player[0].ScoreInt := 7000; player[0].ScoreLineInt := 2000; player[0].ScoreGoldenInt := 1000; @@ -415,86 +523,23 @@ begin player[1].ScoreLineInt := 1100; player[1].ScoreGoldenInt := 900; player[1].ScoreTotalInt := 4500; -*} +//*} //Draw the Background DrawBG; - //Calculate first and last Player on this Screen - if (PlayersPlay > 3) then - begin - case PlayersPlay of - 4: begin - PStart := 1 + ((ScreenAct-1) * 2); - PHigh := 2 + ((ScreenAct-1) * 2); - end; - - 6: begin - PStart := 1 + ((ScreenAct-1) * 3); - PHigh := 3 + ((ScreenAct-1) * 3); - end; - end; - end - else - begin - PStart := 1; - PHigh := PlayersPlay; - end; - // Let's start to arise the bars - CurrentTime := SDL_GetTicks(); - if((CurrentTime >= BarTime) and ShowFinish) then - begin - BarTime := CurrentTime + BarRaiseSpeed; - - for PlayerCounter := PStart to PHigh do - begin - // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarScore_EaseOut_Step:= BarScore_EaseOut_Step + 1; - - // PhrasenBonus - if (BarScore_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1; - - // GoldenNotebonus - if (BarPhrase_EaseOut_Step >= (EaseOut_MaxSteps * 10)) then - begin - if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; - - // Draw golden score bar # - EaseBarIn(PlayerCounter, 'Golden'); - EaseScoreIn(PlayerCounter,'Golden'); - end; - - // Draw phrase score bar # - EaseBarIn(PlayerCounter, 'Line'); - EaseScoreIn(PlayerCounter,'Line'); - end; - - // Draw plain score bar # - EaseBarIn(PlayerCounter, 'Note'); - EaseScoreIn(PlayerCounter,'Note'); + UpdateAnimation; - if (PlayersPlay <= 3) then - //If we play w/ 3 or less players they fit in one screen - //so we don't have to swap the values of themeobjects - //on every draw - FillPlayerItems(PlayerCounter,'Funky'); - - end; + // we have to swap the themeobjects values on every draw + // to support dual screen + for PlayerCounter := 1 to PlayersPlay do + begin + FillPlayerItems(PlayerCounter); end; - if (PlayersPlay > 3) then - //more then 3 players don't fit the screen - //so we have to swap the themeobjects values on every draw - for PlayerCounter := PStart to PHigh do - begin - FillPlayerItems(PlayerCounter,'Funky'); - end; + if (ShowFinish) then + DrawPlayerBars; //Draw Theme Objects DrawFG; @@ -510,54 +555,48 @@ begin Result := true; end; -procedure TscreenScore.FillPlayerItems(PlayerNumber: integer; ScoreType: string); +procedure TscreenScore.FillPlayerItems(PlayerNumber: integer); var ThemeIndex: integer; begin - // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) - Text[TextName[PlayerNumber + ArrayStartModifier]].Text := Ini.Name[PlayerNumber - 1]; - // end todo - - // We have to do this here because we use the same Theme Object - // for players on the first and second screen - case PlayersPlay of - 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; - 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; - 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; - end; - - //golden - Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); - Text[TextGoldenNotesScore[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; + if (ThemeIndex > 0) and ((ScreenAct = PlayerPositionMap[PlayerNumber-1].Screen) or (PlayerPositionMap[PlayerNumber-1].BothScreens)) then + begin + // todo: take the name from player[PlayerNumber].Name instead of the ini when this is done (mog) + Text[TextName[ThemeIndex]].Text := Ini.Name[PlayerNumber-1]; + // end todo - Static[StaticBoxLightest[ThemeIndex]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); - Text[TextGoldenNotes[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); + //golden + Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); + Text[TextGoldenNotesScore[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); - // line bonus - Text[TextLineBonusScore[ThemeIndex]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); - Text[TextLineBonusScore[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); + Static[StaticBoxLightest[ThemeIndex]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); + Text[TextGoldenNotes[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); - Static[StaticBoxLight[ThemeIndex]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); - Text[TextLineBonus[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); + // line bonus + Text[TextLineBonusScore[ThemeIndex]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); + Text[TextLineBonusScore[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); - // plain score - Text[TextNotesScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); - Text[TextNotes[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + Static[StaticBoxLight[ThemeIndex]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); + Text[TextLineBonus[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); - Static[StaticBoxDark[ThemeIndex]].Texture.Alpha := (BarScore_EaseOut_Step / 100); - Text[TextNotesScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + // plain score + Text[TextNotesScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); + Text[TextNotes[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); - // total score - Text[TextTotalScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]); - Text[TextTotalScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + Static[StaticBoxDark[ThemeIndex]].Texture.Alpha := (BarScore_EaseOut_Step / 100); + Text[TextNotesScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + // total score + Text[TextTotalScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber] + TextPhrase_ActualValue[PlayerNumber] + TextGolden_ActualValue[PlayerNumber]); + Text[TextTotalScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); - Text[TextTotal[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); + Text[TextTotal[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); - if(BarGolden_EaseOut_Step = 100) then - begin - ShowRating(PlayerNumber); + if(BarGolden_EaseOut_Step = 100) then + begin + ShowRating(PlayerNumber); + end; end; end; @@ -566,68 +605,63 @@ var Rating: integer; ThemeIndex: integer; begin + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; + if (ThemeIndex > 0) and ((ScreenAct = PlayerPositionMap[PlayerNumber-1].Screen) or (PlayerPositionMap[PlayerNumber-1].BothScreens)) then + begin + case (Player[PlayerNumber-1].ScoreTotalInt) of + 0..2009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); + Rating := 0; + end; + 2010..4009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_AMATEUR'); + Rating := 1; + end; + 4010..5009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_WANNABE'); + Rating := 2; + end; + 5010..6009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_HOPEFUL'); + Rating := 3; + end; + 6010..7509: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_RISING_STAR'); + Rating := 4; + end; + 7510..8509: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); + Rating := 5; + end; + 8510..9009: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); + Rating := 6; + end; + 9010..10000: + begin + Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); + Rating := 7; + end; + else + Rating := 0; // Cheata :P + end; - // We have to do this here because we use the same Theme Object - // for players on the first and second screen - case PlayersPlay of - 1, 2, 3: ThemeIndex := PlayerNumber + ArrayStartModifier; - 4: ThemeIndex := ((PlayerNumber-1) mod 2) + 1 + ArrayStartModifier; - 6: ThemeIndex := ((PlayerNumber-1) mod 3) + 1 + ArrayStartModifier; - end; - - case (Player[PlayerNumber-1].ScoreTotalInt) of - 0..2009: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_TONE_DEAF'); - Rating := 0; - end; - 2010..4009: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_AMATEUR'); - Rating := 1; - end; - 4010..5009: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_WANNABE'); - Rating := 2; - end; - 5010..6009: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_HOPEFUL'); - Rating := 3; - end; - 6010..7509: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_RISING_STAR'); - Rating := 4; - end; - 7510..8509: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_LEAD_SINGER'); - Rating := 5; - end; - 8510..9009: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_SUPERSTAR'); - Rating := 6; - end; - 9010..10000: - begin - Text[TextScore[ThemeIndex]].Text := Language.Translate('SING_SCORE_ULTRASTAR'); - Rating := 7; - end; - else - Rating := 0; // Cheata :P - end; + //todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings + if ( Theme.Score.StaticRatings[ThemeIndex].W > 0 ) and ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then + begin + Text[TextScore[ThemeIndex]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / Theme.Score.StaticRatings[ThemeIndex].W; + end; + // end todo - //todo: this could break if the width is not given, for instance when there's a skin with no picture for ratings - if ( Theme.Score.StaticRatings[ThemeIndex].W > 0 ) and ( aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue > 0 ) then - begin - Text[TextScore[ThemeIndex]].Alpha := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue / Theme.Score.StaticRatings[ThemeIndex].W; + DrawRating(PlayerNumber, Rating); end; - // end todo - - DrawRating(PlayerNumber, Rating); end; procedure TscreenScore.DrawRating(PlayerNumber: integer; Rating: integer); @@ -635,12 +669,13 @@ var Posx: real; Posy: real; Width: real; + ThemeIndex: integer; begin - + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; CalculateBouncing(PlayerNumber); - PosX := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].X + (Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].W * 0.5); - PosY := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].Y + (Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].H * 0.5); ; + PosX := Theme.Score.StaticRatings[ThemeIndex].X + (Theme.Score.StaticRatings[ThemeIndex].W * 0.5); + PosY := Theme.Score.StaticRatings[ThemeIndex].Y + (Theme.Score.StaticRatings[ThemeIndex].H * 0.5); ; Width := aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue/2; @@ -663,14 +698,16 @@ end; function TscreenScore.CalculateBouncing(PlayerNumber: integer): real; var - ReturnValue: real; p, s: real; RaiseStep, MaxVal: real; EaseOut_Step: integer; + ThemeIndex: integer; begin + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; + EaseOut_Step := aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep; - MaxVal := Theme.Score.StaticRatings[PlayerNumber + ArrayStartModifier].W; + MaxVal := Theme.Score.StaticRatings[ThemeIndex].W; RaiseStep := EaseOut_Step; @@ -679,23 +716,21 @@ begin if (RaiseStep = 1) then begin - ReturnValue := MaxVal; + Result := MaxVal; end else begin p := MaxVal * 0.4; s := p/(2*PI) * arcsin (1); - ReturnValue := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; + Result := MaxVal * power(2,-5 * RaiseStep) * sin( (RaiseStep * MaxVal - s) * (2 * PI) / p) + MaxVal; inc(aPlayerScoreScreenRatings[PlayerNumber].RateEaseStep); - aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := ReturnValue; + aPlayerScoreScreenRatings[PlayerNumber].RateEaseValue := Result; end; - - Result := ReturnValue; end; -procedure TscreenScore.EaseBarIn(PlayerNumber: integer; BarType: string); +procedure TscreenScore.EaseBarIn(PlayerNumber: integer; BarType: TScoreBarType); const RaiseSmoothness: integer = 100; var @@ -708,34 +743,31 @@ var lTmp: real; Score: integer; + ThemeIndex: integer; begin - MaxHeight := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].H; + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; + MaxHeight := Theme.Score.StaticBackLevel[ThemeIndex].H; // let's get the points according to the bar we draw // score array starts at 0, which means the score for player 1 is in score[0] // EaseOut_Step is the actual step in the raising process, like the 20iest step of EaseOut_MaxSteps - if (BarType = 'Note') then + if (BarType = sbtScore) then begin Score := Player[PlayerNumber - 1].ScoreInt; RaiseStep := BarScore_EaseOut_Step; - BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y + MaxHeight; + BarStartPosY := Theme.Score.StaticBackLevel[ThemeIndex].Y + MaxHeight; end - else if (BarType = 'Line') then + else if (BarType = sbtLine) then begin Score := Player[PlayerNumber - 1].ScoreLineInt; RaiseStep := BarPhrase_EaseOut_Step; - BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight; + BarStartPosY := Theme.Score.StaticBackLevel[ThemeIndex].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight + MaxHeight; end - else if (BarType = 'Golden') then + else if (BarType = sbtGolden) then begin Score := Player[PlayerNumber - 1].ScoreGoldenInt; RaiseStep := BarGolden_EaseOut_Step; - BarStartPosY := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight; - end - else - begin - Log.LogCritical('Unknown bar-type: ' + BarType, 'TScreenScore.EaseBarIn'); - Exit; // suppress warnings + BarStartPosY := Theme.Score.StaticBackLevel[ThemeIndex].Y - aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight - aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight + MaxHeight; end; // the height dependend of the score @@ -760,31 +792,34 @@ begin DrawBar(BarType, PlayerNumber, BarStartPosY, NewHeight); - if (BarType = 'Note') then + if (BarType = sbtScore) then aPlayerScoreScreenDatas[PlayerNumber].BarScore_ActualHeight := NewHeight - else if (BarType = 'Line') then + else if (BarType = sbtLine) then aPlayerScoreScreenDatas[PlayerNumber].BarLine_ActualHeight := NewHeight - else if (BarType = 'Golden') then + else if (BarType = sbtGolden) then aPlayerScoreScreenDatas[PlayerNumber].BarGolden_ActualHeight := NewHeight; end; -procedure TscreenScore.DrawBar(BarType: string; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); +procedure TscreenScore.DrawBar(BarType: TScoreBarType; PlayerNumber: integer; BarStartPosY: single; NewHeight: real); var Width: real; BarStartPosX: real; + ThemeIndex: integer; begin + ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; + // this is solely for better readability of the drawing - Width := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].W; - BarStartPosX := Theme.Score.StaticBackLevel[PlayerNumber + ArrayStartModifier].X; + Width := Theme.Score.StaticBackLevel[ThemeIndex].W; + BarStartPosX := Theme.Score.StaticBackLevel[ThemeIndex].X; glColor4f(1, 1, 1, 1); // set the texture for the bar - if (BarType = 'Note') then + if (BarType = sbtScore) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Dark.TexNum); - if (BarType = 'Line') then + if (BarType = sbtLine) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Light.TexNum); - if (BarType = 'Golden') then + if (BarType = sbtGolden) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarLevel_Lightest.TexNum); //draw it @@ -803,11 +838,11 @@ begin glDisable(GL_TEXTURE_2d); //the round thing on top - if (BarType = 'Note') then + if (BarType = sbtScore) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Dark.TexNum); - if (BarType = 'Line') then + if (BarType = sbtLine) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Light.TexNum); - if (BarType = 'Golden') then + if (BarType = sbtGolden) then glBindTexture(GL_TEXTURE_2D, aPlayerScoreScreenTextures[PlayerNumber].Score_NoteBarRound_Lightest.TexNum); glEnable(GL_TEXTURE_2D); @@ -815,8 +850,8 @@ begin glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + ArrayStartModifier]].Texture.h) - NewHeight, ZBars); - glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[PlayerNumber + ArrayStartModifier]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); glEnd; @@ -825,7 +860,7 @@ begin glDisable(GL_TEXTURE_2d); end; -procedure TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType: string); +procedure TScreenScore.EaseScoreIn(PlayerNumber: integer; ScoreType: TScoreBarType); const RaiseSmoothness: integer = 100; var @@ -835,19 +870,19 @@ var EaseOut_Step: real; ActualScoreValue: integer; begin - if (ScoreType = 'Note') then + if (ScoreType = sbtScore) then begin EaseOut_Step := BarScore_EaseOut_Step; ActualScoreValue := TextScore_ActualValue[PlayerNumber]; ScoreReached := Player[PlayerNumber-1].ScoreInt; end; - if (ScoreType = 'Line') then + if (ScoreType = sbtLine) then begin EaseOut_Step := BarPhrase_EaseOut_Step; ActualScoreValue := TextPhrase_ActualValue[PlayerNumber]; ScoreReached := Player[PlayerNumber-1].ScoreLineInt; end; - if (ScoreType = 'Golden') then + if (ScoreType = sbtGolden) then begin EaseOut_Step := BarGolden_EaseOut_Step; ActualScoreValue := TextGolden_ActualValue[PlayerNumber]; @@ -868,21 +903,21 @@ begin if ( lTmpA > 0 ) and ( RaiseSmoothness > 0 ) then begin - if (ScoreType = 'Note') then + if (ScoreType = sbtScore) then TextScore_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); - if (ScoreType = 'Line') then + if (ScoreType = sbtLine) then TextPhrase_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); - if (ScoreType = 'Golden') then + if (ScoreType = sbtGolden) then TextGolden_ActualValue[PlayerNumber] := floor( lTmpA / RaiseSmoothness); end; end else begin - if (ScoreType = 'Note') then + if (ScoreType = sbtScore) then TextScore_ActualValue[PlayerNumber] := ScoreReached; - if (ScoreType = 'Line') then + if (ScoreType = sbtLine) then TextPhrase_ActualValue[PlayerNumber] := ScoreReached; - if (ScoreType = 'Golden') then + if (ScoreType = sbtGolden) then TextGolden_ActualValue[PlayerNumber] := ScoreReached; end; end; -- cgit v1.2.3 From 88cc86f8f6805aa8c444892ce6ac670694ea86e8 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 13 Jan 2010 01:50:32 +0000 Subject: commented forgotten debug stuff git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2086 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 20fd0d9e..1b965832 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -513,7 +513,7 @@ var PStart: integer; PHigh: integer; begin -//{* +{* player[0].ScoreInt := 7000; player[0].ScoreLineInt := 2000; player[0].ScoreGoldenInt := 1000; -- cgit v1.2.3 From f9aeb4b3618d327bc0475ffe72b755fe0d5156fe Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 14 Jan 2010 17:51:44 +0000 Subject: rating icon bouncing depends on time now instead of frames git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2090 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 1b965832..bbc0be1d 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -347,7 +347,12 @@ begin // GoldenNotebonus else if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1; + BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1 + + // rating icon + else + for I := 1 to PlayersPlay do + CalculateBouncing(I); end; end; @@ -672,7 +677,6 @@ var ThemeIndex: integer; begin ThemeIndex := PlayerPositionMap[PlayerNumber-1].Position; - CalculateBouncing(PlayerNumber); PosX := Theme.Score.StaticRatings[ThemeIndex].X + (Theme.Score.StaticRatings[ThemeIndex].W * 0.5); PosY := Theme.Score.StaticRatings[ThemeIndex].Y + (Theme.Score.StaticRatings[ThemeIndex].H * 0.5); ; -- cgit v1.2.3 From 58e4a47fb4c509af436c36e74b98d98ba66a2e9c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 14 Jan 2010 21:36:38 +0000 Subject: comment unnessecary get_texture call that seems to lead to errors git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2091 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index f1fdba4d..7b52609a 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -227,7 +227,7 @@ procedure TScreenSong.ShowCatTL(Cat: integer); begin //Change Text[TextCat].Text := CatSongs.Song[Cat].Artist; - Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); + //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); //Show Text[TextCat].Visible := true; -- cgit v1.2.3 From ecf41a3f0e7c5770cea44659b27162cfaad78a37 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 18 Jan 2010 14:10:28 +0000 Subject: fixed score screen animation speed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2092 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index bbc0be1d..f1196654 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -88,6 +88,13 @@ type end; APlayerPositionMap = array of TPlayerPositionMap; + { textures for playerstatics of seconds screen players } + TPlayerStaticTexture = class + Tex: TTexture; + Player: integer; // 0..5 playernumber + + end; + TScreenScore = class(TMenu) private { holds position and screen of players(index) @@ -333,27 +340,28 @@ var begin CurrentTime := SDL_GetTicks(); - if (ScreenAct = 1) and ((CurrentTime >= BarTime) and ShowFinish) then - begin - BarTime := CurrentTime + BarRaiseSpeed; + if (ScreenAct = 1) and ShowFinish then + while (CurrentTime >= BarTime) do + begin + Inc(BarTime, BarRaiseSpeed); - // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) - if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarScore_EaseOut_Step:= BarScore_EaseOut_Step + 1 + // We actually arise them in the right order, but we have to draw them in reverse order (golden -> phrase -> mainscore) + if (BarScore_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarScore_EaseOut_Step:= BarScore_EaseOut_Step + 1 - // PhrasenBonus - else if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1 + // PhrasenBonus + else if (BarPhrase_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarPhrase_EaseOut_Step := BarPhrase_EaseOut_Step + 1 - // GoldenNotebonus - else if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then - BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1 + // GoldenNotebonus + else if (BarGolden_EaseOut_Step < EaseOut_MaxSteps * 10) then + BarGolden_EaseOut_Step := BarGolden_EaseOut_Step + 1 - // rating icon - else - for I := 1 to PlayersPlay do - CalculateBouncing(I); - end; + // rating icon + else + for I := 1 to PlayersPlay do + CalculateBouncing(I); + end; end; procedure TScreenScore.DrawPlayerBars; @@ -509,6 +517,8 @@ begin TextPhrase_ActualValue[index] := 0; TextGolden_ActualValue[index] := 0; end; + + BarTime := SDL_GetTicks(); end; function TScreenScore.Draw: boolean; -- cgit v1.2.3 From 0dbd158dd852f9389e6e29006abdc4a1f3ed54ba Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 18 Feb 2010 16:50:22 +0000 Subject: fix assembla ticket #91 - Preview does not stop git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2105 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSongJumpto.pas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index 7f82bbec..d0fa907a 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -233,9 +233,12 @@ begin ScreenSong.FixSelected; //Play Correct Music - if (ScreenSong.Interaction <> fLastPlayed) then + if (ScreenSong.Interaction <> fLastPlayed) or (CatSongs.VisibleSongs = 0) then begin - fLastPlayed := ScreenSong.Interaction; + if (CatSongs.VisibleSongs > 0) then + fLastPlayed := ScreenSong.Interaction + else + fLastPlayed := -1; ScreenSong.ChangeMusic; end; -- cgit v1.2.3 From c710a7b0d52b408b865e82eb55480146cbbbaed7 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 22 Feb 2010 15:59:35 +0000 Subject: completly remove unused UScreenWelcome git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2138 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenWelcome.pas | 164 ----------------------------------------- 1 file changed, 164 deletions(-) delete mode 100644 src/screens/UScreenWelcome.pas (limited to 'src/screens') diff --git a/src/screens/UScreenWelcome.pas b/src/screens/UScreenWelcome.pas deleted file mode 100644 index 4b463613..00000000 --- a/src/screens/UScreenWelcome.pas +++ /dev/null @@ -1,164 +0,0 @@ -{* UltraStar Deluxe - Karaoke Game - * - * UltraStar Deluxe is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; see the file COPYING. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - * $URL$ - * $Id$ - *} - -unit UScreenWelcome; - -interface - -{$IFDEF FPC} - {$MODE Delphi} -{$ENDIF} - -{$I switches.inc} - -uses - UMenu, - SDL, - SysUtils, - UThemes; - -type - TScreenWelcome = class(TMenu) - public - Animation: real; - Fadeout: boolean; - constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function Draw: boolean; override; - procedure OnShow; override; - end; - -implementation - -uses - UGraphic, - UTime, - USkins, - UTexture; - -function TScreenWelcome.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; -begin - Result := true; - if (PressedDown) then - begin - case PressedKey of - SDLK_ESCAPE, - SDLK_BACKSPACE : - begin - Result := false; - end; - SDLK_RETURN: - begin - FadeTo(@ScreenMain); - Fadeout := true; - end; - end; - end; -end; - -constructor TScreenWelcome.Create; -begin - inherited Create; - AddStatic(-10, -10, 0, 0, 1, 1, 1, Skin.GetTextureFileName('ButtonAlt'), TEXTURE_TYPE_TRANSPARENT); - AddStatic(-500, 440, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); - AddStatic(-500, 472, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); - AddStatic(-500, 504, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); - AddStatic(-500, 536, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); - AddStatic(-500, 568, 200, 5, 0, 0, 0, Skin.GetTextureFileName('Rectangle'), TEXTURE_TYPE_COLORIZED); - Animation := 0; - Fadeout := false; -end; - -procedure TScreenWelcome.OnShow; -begin - inherited; - - CountSkipTimeSet; -end; - -function TScreenWelcome.Draw: boolean; -var - Min: real; - Max: real; - Factor: real; - Count: integer; -begin - // star animation - Animation := Animation + TimeSkip*1000; - - // draw nothing - Min := 0; Max := 1000; - if (Animation >= Min) and (Animation < Max) then - begin - end; - - // popup - Min := 1000; Max := 1120; - if (Animation >= Min) and (Animation < Max) then - begin - Factor := (Animation - Min) / (Max - Min); - Static[0].Texture.X := 600; - Static[0].Texture.Y := 600 - Factor * 230; - Static[0].Texture.W := 200; - Static[0].Texture.H := Factor * 230; - end; - - // bounce - Min := 1120; Max := 1200; - if (Animation >= Min) and (Animation < Max) then - begin - Factor := (Animation - Min) / (Max - Min); - Static[0].Texture.Y := 370 + Factor * 50; - Static[0].Texture.H := 230 - Factor * 50; - end; - - // run - Min := 1500; Max := 3500; - if (Animation >= Min) and (Animation < Max) then - begin - Factor := (Animation - Min) / (Max - Min); - - Static[0].Texture.X := 600 - Factor * 1400; - Static[0].Texture.H := 180; - - for Count := 1 to 5 do - begin - Static[Count].Texture.X := 770 - Factor * 1400; - Static[Count].Texture.W := 150 + Factor * 200; - Static[Count].Texture.Alpha := Factor * 0.5; - end; - end; - - Min := 3500; - if (Animation >= Min) and (not Fadeout) then - begin - FadeTo(@ScreenMain); - Fadeout := true; - end; - - Result := inherited Draw; -end; - -end. -- cgit v1.2.3 From 62b08a9e7cfb086fd302f5c3741eb4092ea6ee73 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 22 Feb 2010 17:43:10 +0000 Subject: cleanup of code, which has never been used from start. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2142 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGraphics.pas | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 8ca13f09..f3604c3e 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -84,10 +84,6 @@ begin end; SDLK_RETURN: begin -{ if SelInteraction <= 1 then - begin - Restart := true; - end;} if SelInteraction = 6 then begin Ini.Save; -- cgit v1.2.3 From fa98e12acb82de42206e6aafba731255cac41eba Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 22 Feb 2010 17:55:57 +0000 Subject: cleanup of code, which has never been used from start. Part 3. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2145 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsGraphics.pas | 1 - 1 file changed, 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index f3604c3e..504ed813 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -54,7 +54,6 @@ implementation uses UGraphic, - UMain, UUnicodeUtils, SysUtils; -- cgit v1.2.3 From 54f567282784181b99a3012fd9db03dae60f361e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 22 Feb 2010 18:27:15 +0000 Subject: screens code cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2146 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditConvert.pas | 5 ++--- src/screens/UScreenOptions.pas | 2 -- src/screens/UScreenOptionsAdvanced.pas | 2 -- src/screens/UScreenOptionsGraphics.pas | 2 -- src/screens/UScreenPartyOptions.pas | 1 - src/screens/UScreenPartyPlayer.pas | 1 - src/screens/UScreenPartyRounds.pas | 3 --- src/screens/UScreenPartyScore.pas | 2 -- src/screens/UScreenPartyWin.pas | 4 +--- src/screens/UScreenScore.pas | 3 --- src/screens/UScreenSong.pas | 2 -- 11 files changed, 3 insertions(+), 24 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditConvert.pas b/src/screens/UScreenEditConvert.pas index b2fb7773..8b13d410 100644 --- a/src/screens/UScreenEditConvert.pas +++ b/src/screens/UScreenEditConvert.pas @@ -602,15 +602,15 @@ begin end; procedure TScreenEditConvert.OnShow; +{$IFDEF UseMIDIPort} var T: integer; // track N: integer; // note - {$IFDEF UseMIDIPort} MidiTrack: TMidiTrack; MidiEvent: PMidiEvent; - {$ENDIF} FileOpened: boolean; KMIDITrackIndex, SMFTrackIndex: integer; +{$ENDIF} begin inherited; @@ -731,7 +731,6 @@ var Y: real; Height: real; YSkip: real; - TrackName: UTF8String; begin // draw static menu inherited Draw; diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index 3a046400..bdb37701 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -146,8 +146,6 @@ begin end; constructor TScreenOptions.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 7116ad40..7a4ce15b 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -121,8 +121,6 @@ begin end; constructor TScreenOptionsAdvanced.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index 504ed813..fc58626b 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -121,8 +121,6 @@ begin end; constructor TScreenOptionsGraphics.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; LoadFromTheme(Theme.OptionsGraphics); diff --git a/src/screens/UScreenPartyOptions.pas b/src/screens/UScreenPartyOptions.pas index 998d3655..f63b37fb 100644 --- a/src/screens/UScreenPartyOptions.pas +++ b/src/screens/UScreenPartyOptions.pas @@ -81,7 +81,6 @@ uses function TScreenPartyOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var I, J: integer; - OnlyMultiPlayer: boolean; begin Result := true; if (PressedDown) then diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index 3fcaa4ba..3f9c0f77 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -126,7 +126,6 @@ end; procedure TScreenPartyPlayer.UpdateParty; var I, J: integer; - Rounds: ARounds; begin {//Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do diff --git a/src/screens/UScreenPartyRounds.pas b/src/screens/UScreenPartyRounds.pas index 5211e32c..070c9eb8 100644 --- a/src/screens/UScreenPartyRounds.pas +++ b/src/screens/UScreenPartyRounds.pas @@ -114,9 +114,6 @@ begin end; function TScreenPartyRounds.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; -var - I, J: integer; - OnlyMultiPlayer: boolean; begin Result := true; if (PressedDown) then diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 09f92dbc..3bfca4a8 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -124,7 +124,6 @@ end; constructor TScreenPartyScore.Create; var -// I: integer; // Auto Removed, Unused Variable Tex: TTexture; R, G, B: real; Color: integer; @@ -198,7 +197,6 @@ end; procedure TScreenPartyScore.OnShow; var - I, J: integer; Ranking: AParty_TeamRanking; begin inherited; diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index 3d7092bc..d9fd26d4 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -104,8 +104,6 @@ begin end; constructor TScreenPartyWin.Create; -//var -// I: integer; // Auto Removed, Unused Variable begin inherited Create; @@ -133,7 +131,7 @@ end; procedure TScreenPartyWin.OnShow; var - I, J: integer; + I: integer; Ranking: AParty_TeamRanking; Function GetTeamColor(Team: integer): cardinal; diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index f1196654..40fe8fbc 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -523,10 +523,7 @@ end; function TScreenScore.Draw: boolean; var - CurrentTime: cardinal; PlayerCounter: integer; - PStart: integer; - PHigh: integer; begin {* player[0].ScoreInt := 7000; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 7b52609a..8c4c1608 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1012,8 +1012,6 @@ end; procedure TScreenSong.SetScroll1; var B: integer; // button - //BMin: integer; // button min // Auto Removed, Unused Variable - //BMax: integer; // button max // Auto Removed, Unused Variable Src: integer; //Dst: integer; Count: integer; // Dst is not used. Count is used. -- cgit v1.2.3 From a27eaddc1e751f71eb38565848c9fae3b847dd8c Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 22 Feb 2010 20:31:55 +0000 Subject: songflow don't stop now during song scrolling and seems to be more "flowy" hopefully the last hack to this old and dirty code, should be rewritten for 1.2 UScreenSongJumpTo may need some changes git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2147 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 108 +++++++++++++++++++++++++------------------- 1 file changed, 61 insertions(+), 47 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 8c4c1608..b127c296 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -60,6 +60,8 @@ type PreviewOpened: Integer; // interaction of the Song that is loaded for preview music // -1 if nothing is opened + isScrolling: boolean; // true if song flow is about to move + procedure StartMusicPreview(); procedure StopMusicPreview(); public @@ -148,6 +150,9 @@ type procedure DoJoker(Team: integer); procedure SelectPlayers; + procedure OnSongSelect; // called when song flows movement stops at a song + procedure OnSongDeSelect; // called before current song is deselected + procedure UnloadDetailedCover; //Extensions @@ -299,7 +304,6 @@ begin AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; SetScroll4; //Break and Exit Exit; @@ -322,7 +326,6 @@ begin AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; SetScroll4; //Break and Exit @@ -476,7 +479,6 @@ begin end; AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; SetScroll4; end; Exit; @@ -536,8 +538,6 @@ begin //Show Wrong Song when Tabs on Fix SelectNext(true); FixSelected; - - ChangeMusic; end else begin @@ -576,9 +576,6 @@ begin //Show Wrong Song when Tabs on Fix SelectNext(true); FixSelected; - - //Play Music: - ChangeMusic; end else begin // clicked on song @@ -639,8 +636,6 @@ begin //Play Music: AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; - end; // @@ -683,7 +678,6 @@ begin //Play Music: AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; end; end; //Cat Change Hack End} @@ -696,9 +690,6 @@ begin begin AudioPlayback.PlaySound(SoundLib.Change); SelectNext(true); - //InteractNext; - //SongTarget := Interaction; - ChangeMusic; SetScroll4; end; end; @@ -709,7 +700,6 @@ begin begin AudioPlayback.PlaySound(SoundLib.Change); SelectPrev(true); - ChangeMusic; SetScroll4; end; end; @@ -889,6 +879,7 @@ begin Equalizer := Tms_Equalizer.Create(AudioPlayback, Theme.Song.Equalizer); PreviewOpened := -1; + isScrolling := false; end; procedure TScreenSong.GenerateThumbnails(); @@ -957,6 +948,28 @@ begin Interaction := 0; end; +{ called when song flows movement stops at a song } +procedure TScreenSong.OnSongSelect; +begin + if (Ini.PreviewVolume <> 0) then + begin + StartMusicPreview; + end; + + // fade in detailed cover + CoverTime := 0; +end; + +{ called before current song is deselected } +procedure TScreenSong.OnSongDeSelect; +begin + CoverTime := 10; + UnLoadDetailedCover; + + StopMusicPreview(); + PreviewOpened := -1; +end; + procedure TScreenSong.SetScroll; var VS, B: integer; @@ -1474,6 +1487,7 @@ begin SoundLib.PauseBgMusic; AudioPlayback.Stop; + PreviewOpened := -1; if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; @@ -1489,12 +1503,6 @@ begin if Length(CatSongs.Song) > 0 then begin - //Load Music only when Song Preview is activated - if ( Ini.PreviewVolume <> 0 ) then - StartMusicPreview() - else - PreviewOpened := -1; - SetScroll; end; @@ -1505,7 +1513,6 @@ begin if (CatSongs.CatNumShow = -3) then begin SelectNext(true); - ChangeMusic; end; end //Party Mode @@ -1520,6 +1527,7 @@ begin end; end; + isScrolling := true; SetJoker; SetStatics; end; @@ -1560,13 +1568,23 @@ var dt: real; I: integer; begin - dx := SongTarget-SongCurrent; - dt := TimeSkip * 7; + if isScrolling then + begin + dx := SongTarget-SongCurrent; + dt := TimeSkip * 7; - if dt > 1 then - dt := 1; - - SongCurrent := SongCurrent + dx*dt; + if dt > 1 then + dt := 1; + + SongCurrent := SongCurrent + dx*dt; + + if SameValue(SongCurrent, SongTarget, 0.002) and (CatSongs.VisibleSongs > 0) then + begin + isScrolling := false; + SongCurrent := SongTarget; + OnSongSelect; + end; + end; { if SongCurrent > Catsongs.VisibleSongs then @@ -1643,8 +1661,11 @@ begin if VS > 0 then begin - if UnloadCover then //that should fix the performance problem on scrolling - UnLoadDetailedCover; + if (not isScrolling) and (VS > 1) then + begin + isScrolling := true; + OnSongDeselect; + end; Skip := 1; @@ -1677,10 +1698,13 @@ var begin VS := CatSongs.VisibleSongs; - if VS > 0 then + if VS > 1 then begin - if UnloadCover then - UnLoadDetailedCover; //that should fix the performance problem on scrolling + if (not isScrolling) and (VS > 1) then + begin + isScrolling := true; + OnSongDeselect; + end; Skip := 1; @@ -1708,6 +1732,9 @@ var begin AudioPlayback.Close(); + if CatSongs.VisibleSongs = 0 then + Exit; + Song := CatSongs.Song[Interaction]; if not assigned(Song) then Exit; @@ -1768,23 +1795,13 @@ procedure TScreenSong.ChangeMusic; begin StopMusicPreview(); PreviewOpened := -1; - - // Preview song if activated and current selection is not a category cover - if (CatSongs.VisibleSongs > 0) and - (not CatSongs.Song[Interaction].Main) and - (Ini.PreviewVolume <> 0) then - begin - // Delay song fading to prevent the song from being played while scrolling - MusicPreviewTimer := SDL_AddTimer(200, MusicPreviewTimerCallback, Self); - end; + StartMusicPreview(); end; procedure TScreenSong.SkipTo(Target: cardinal); var i: integer; begin - UnLoadDetailedCover; - Interaction := High(CatSongs.Song); SongTarget := 0; @@ -1853,7 +1870,6 @@ begin end; AudioPlayback.PlaySound(SoundLib.Change); - ChangeMusic; SetScroll; end; @@ -2016,8 +2032,6 @@ end; //Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song procedure TScreenSong.UnloadDetailedCover; begin - CoverTime := 0; - // show cached texture Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, true); Button[Interaction].Texture2.Alpha := 0; -- cgit v1.2.3 From f22fb5843becc1824bf2ea66bfd1b0626546c8a2 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 22 Feb 2010 20:37:08 +0000 Subject: remove unused code from prev version of ScreenSong git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2148 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index b127c296..7fda384c 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1773,23 +1773,6 @@ begin AudioPlayback.Stop; end; -procedure StartMusicPreview(data: Pointer); -var - ScreenSong: TScreenSong; -begin - ScreenSong := TScreenSong(data); - if (ScreenSong <> nil) then - ScreenSong.StartMusicPreview(); -end; - -function MusicPreviewTimerCallback(interval: UInt32; param: Pointer): UInt32; cdecl; -begin - // delegate execution to main-thread - MainThreadExec(@StartMusicPreview, param); - // stop timer - Result := 0; -end; - // Changes previewed song procedure TScreenSong.ChangeMusic; begin -- cgit v1.2.3 From fe89b3386a77be606a54128af3a5a55250691554 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 14 Mar 2010 19:27:47 +0000 Subject: editor: changed design, added infobar, changed key-mapping git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2194 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 332 ++++++++++++++++++++++++++++++++++------- 1 file changed, 274 insertions(+), 58 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 10584ce8..3e7bd134 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -56,6 +56,7 @@ uses type TScreenEditSub = class(TMenu) private + AktBeat: integer; //Variable is True if no Song is loaded Error: boolean; @@ -110,6 +111,8 @@ type procedure PasteText; procedure CopySentence(Src, Dst: integer); procedure CopySentences(Src, Dst, Num: integer); + procedure DrawStatics; + procedure DrawInfoBar(x, y, w, h: integer); //Note Name Mod function GetNoteName(Note: integer): string; public @@ -184,13 +187,13 @@ begin if (PressedDown) then // Key Down begin // check normal keys - case UCS4UpperCase(CharCode) of - Ord('Q'): + case PressedKey of + SDLK_Q: begin Result := false; Exit; end; - Ord('S'): + SDLK_S: begin // Save Song SResult := SaveSong(CurrentSong, Lines[0], CurrentSong.Path.Append(CurrentSong.FileName), @@ -210,19 +213,25 @@ begin end; Exit; end; - Ord('D'): + SDLK_D: begin // Divide lengths by 2 - DivideBPM; - Exit; + if (SDL_ModState = KMOD_LSHIFT) then + begin + DivideBPM; + Exit; + end; end; - Ord('M'): + SDLK_M: begin // Multiply lengths by 2 - MultiplyBPM; - Exit; + if (SDL_ModState = KMOD_LSHIFT) then + begin + MultiplyBPM; + Exit; + end; end; - Ord('C'): + SDLK_C: begin // Capitalize letter at the beginning of line if SDL_ModState = 0 then @@ -238,7 +247,7 @@ begin Exit; end; - Ord('V'): + SDLK_V: begin // Paste text if SDL_ModState = KMOD_LCTRL then @@ -254,13 +263,13 @@ begin CopySentence(CopySrc, Lines[0].Current); end; end; - Ord('T'): + SDLK_T: begin // Fixes timings between sentences FixTimings; Exit; end; - Ord('P'): + SDLK_P: begin if SDL_ModState = 0 then begin @@ -307,7 +316,7 @@ begin end; // Golden Note - Ord('G'): + SDLK_G: begin if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntGolden) then Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal @@ -318,7 +327,7 @@ begin end; // Freestyle Note - Ord('F'): + SDLK_F: begin if (Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType = ntFreestyle) then Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal @@ -761,15 +770,17 @@ procedure TScreenEditSub.DivideBPM; var C: integer; N: integer; -begin + +begin CurrentSong.BPM[0].BPM := CurrentSong.BPM[0].BPM / 2; + for C := 0 to Lines[0].High do begin Lines[0].Line[C].Start := Lines[0].Line[C].Start div 2; Lines[0].Line[C].End_ := Lines[0].Line[C].End_ div 2; for N := 0 to Lines[0].Line[C].HighNote do begin - Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; + Lines[0].Line[C].Note[N].Start := Lines[0].Line[C].Note[N].Start div 2; Lines[0].Line[C].Note[N].Length := Round(Lines[0].Line[C].Note[N].Length / 2); end; // N end; // C @@ -1227,55 +1238,258 @@ begin CopySentence(Src + C, Dst + C); end; +procedure TScreenEditSub.DrawStatics; +var + x, y, w, h: Integer; +begin + //Theme: + //bg + glDisable(GL_BLEND); + + x := 0; + y := 0; + w := 800; + h := 600; + glColor4f(0.3, 0.5, 0.6, 1); + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + // Line + glColor4f(0.9, 0.9, 0.9, 1); + x := 20; + y := 5; + w := 200; + h := 40; + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + // Note + x := 260; + y := 5; + w := 200; + h := 40; + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + // some borders + x := 20; + y := 55; + w := 760; + h := 236; + glColor4f(0.9, 0.9, 0.9, 1); + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + glColor4f(0, 0, 0, 1); + glLineWidth(2); + glBegin(GL_LINE_LOOP); + glVertex2f(x-1, y-1); + glVertex2f(x+w+1, y-1); + glVertex2f(x+w+1, y+h+1); + glVertex2f(x-1, y+h+1); + glEnd; + + x := 20; + y := 305; + w := 760; + h := 135; + glColor4f(0.9, 0.9, 0.9, 1); + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + glColor4f(0, 0, 0, 1); + glLineWidth(2); + glBegin(GL_LINE_LOOP); + glVertex2f(x-1, y-1); + glVertex2f(x+w+1, y-1); + glVertex2f(x+w+1, y+h+1); + glVertex2f(x-1, y+h+1); + glEnd; + + x := 20; + y := 500; + w := 760; + h := 40; + glColor4f(0.9, 0.9, 0.9, 1); + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + glColor4f(0, 0, 0, 1); + glLineWidth(2); + glBegin(GL_LINE_LOOP); + glVertex2f(x-1, y-1); + glVertex2f(x+w+1, y-1); + glVertex2f(x+w+1, y+h+1); + glVertex2f(x-1, y+h+1); + glEnd; + + glLineWidth(1); +end; + +procedure TScreenEditSub.DrawInfoBar(x, y, w, h: integer); +var + start, end_: integer; + ww: integer; + + pos: real; + br: real; + + line, note: integer; + numLines, numNotes: integer; + +begin + numLines := Length(Lines[0].Line); + + if(numLines=0) then + Exit; + + start := Lines[0].Line[0].Start; + end_ := Lines[0].Line[numLines-1].End_; + ww := end_ - start; + + glColor4f(0, 0, 0, 1); + glDisable(GL_BLEND); + glLineWidth(2); + glBegin(GL_LINE_LOOP); + glVertex2f(x-1, y-1); + glVertex2f(x+w+1, y-1); + glVertex2f(x+w+1, y+h+1); + glVertex2f(x-1, y+h+1); + glEnd; + + glColor4f(0.9, 0.9, 0.9, 1); + glbegin(gl_quads); + glVertex2f(x, y); + glVertex2f(x, y+h); + glVertex2f(x+w, y+h); + glVertex2f(x+w, y); + glEnd; + + + for line := 0 to numLines - 1 do + begin + if (line = Lines[0].Current) and not (PlaySentence or PlaySentenceMidi) then + glColor4f(0.4, 0.4, 0, 1) + else + glColor4f(1, 0.6, 0, 1); + + + start := Lines[0].Line[line].Note[0].Start; + end_ := Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Start+ + Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Length; + + pos := start/ww*w; + br := (end_-start)/ww*w; + + glbegin(gl_quads); + glVertex2f(x+pos, y); + glVertex2f(x+pos, y+h); + glVertex2f(x+pos+br, y+h); + glVertex2f(x+pos+br, y); + glEnd; + { + numNotes := Length(Lines[0].Line[line].Nuta); + + for note := 0 to numNotes - 1 do + begin + + end; } + end; + + if(PlaySentence or PlaySentenceMidi) then + begin + glColor4f(0, 0, 0, 0.5); + pos := 0; + br := AktBeat/ww*w; + if (br>w) then + br := w; + end else + begin + glColor4f(1, 0, 0, 1); + pos := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start/ww*w; + br := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length/ww*w; + if (br<1) then + br := 1; + end; + + glEnable(GL_BLEND); + glbegin(gl_quads); + glVertex2f(x+pos, y); + glVertex2f(x+pos, y+h); + glVertex2f(x+pos+br, y+h); + glVertex2f(x+pos+br, y); + glEnd; + glDisable(GL_BLEND); + + glLineWidth(1); +end; + constructor TScreenEditSub.Create; begin inherited Create; SetLength(Player, 1); // line - AddStatic(20, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); - AddText(40, 17, 1, 18, 1, 1, 1, 'Line'); - TextSentence := AddText(120, 14, 1, 24, 0, 0, 0, '0 / 0'); + AddText(40, 14, 1, 24, 0, 0, 0, 'Line:'); + TextSentence := AddText(110, 14, 1, 24, 0, 0, 0, '0 / 0'); + // Note - AddStatic(220, 10, 80, 30, 0, 0, 0, Skin.GetTextureFileName('ButtonF'), TEXTURE_TYPE_COLORIZED); - AddText(242, 17, 1, 18, 1, 1, 1, 'Note'); - TextNote := AddText(320, 14, 1, 24, 0, 0, 0, '0 / 0'); + AddText(282, 14, 1, 24, 0, 0, 0, 'Note:'); + TextNote := AddText(360, 14, 1, 24, 0, 0, 0, '0 / 0'); // file info - AddStatic(150, 50, 500, 150, 0, 0, 0, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); - AddStatic(151, 52, 498, 146, 1, 1, 1, Skin.GetTextureFileName('MainBar'), TEXTURE_TYPE_COLORIZED); - AddText(180, 65, 0, 24, 0, 0, 0, 'Title:'); - AddText(180, 90, 0, 24, 0, 0, 0, 'Artist:'); - AddText(180, 115, 0, 24, 0, 0, 0, 'Mp3:'); - AddText(180, 140, 0, 24, 0, 0, 0, 'BPM:'); - AddText(180, 165, 0, 24, 0, 0, 0, 'GAP:'); - - TextTitle := AddText(250, 65, 0, 24, 0, 0, 0, 'a'); - TextArtist := AddText(250, 90, 0, 24, 0, 0, 0, 'b'); - TextMp3 := AddText(250, 115, 0, 24, 0, 0, 0, 'c'); - TextBPM := AddText(250, 140, 0, 24, 0, 0, 0, 'd'); - TextGAP := AddText(250, 165, 0, 24, 0, 0, 0, 'e'); - -{ AddInteraction(2, TextTitle); - AddInteraction(2, TextArtist); - AddInteraction(2, TextMp3); - AddInteraction(2, TextBPM); - AddInteraction(2, TextGAP);} + AddText(30, 65, 0, 24, 0, 0, 0, 'Title:'); + AddText(30, 90, 0, 24, 0, 0, 0, 'Artist:'); + AddText(30, 115, 0, 24, 0, 0, 0, 'Mp3:'); + AddText(30, 140, 0, 24, 0, 0, 0, 'BPM:'); + AddText(30, 165, 0, 24, 0, 0, 0, 'GAP:'); + + TextTitle := AddText(180, 65, 0, 24, 0, 0, 0, 'a'); + TextArtist := AddText(180, 90, 0, 24, 0, 0, 0, 'b'); + TextMp3 := AddText(180, 115, 0, 24, 0, 0, 0, 'c'); + TextBPM := AddText(180, 140, 0, 24, 0, 0, 0, 'd'); + TextGAP := AddText(180, 165, 0, 24, 0, 0, 0, 'e'); // note info - AddText(20, 190, 0, 24, 0, 0, 0, 'Start:'); - AddText(20, 215, 0, 24, 0, 0, 0, 'Duration:'); - AddText(20, 240, 0, 24, 0, 0, 0, 'Tone:'); - AddText(20, 265, 0, 24, 0, 0, 0, 'Text:'); + AddText(30, 190, 0, 24, 0, 0, 0, 'Start:'); + AddText(30, 215, 0, 24, 0, 0, 0, 'Duration:'); + AddText(30, 240, 0, 24, 0, 0, 0, 'Tone:'); + AddText(30, 265, 0, 24, 0, 0, 0, 'Text:'); //AddText(500, 265, 0, 8, 0, 0, 0, 'VideoGap:'); + + TextNStart := AddText(180, 190, 0, 24, 0, 0, 0, 'a'); + TextNLength := AddText(180, 215, 0, 24, 0, 0, 0, 'b'); + TextNTon := AddText(180, 240, 0, 24, 0, 0, 0, 'c'); + TextNText := AddText(180, 265, 0, 24, 0, 0, 0, 'd'); - TextNStart := AddText(120, 190, 0, 24, 0, 0, 0, 'a'); - TextNLength := AddText(120, 215, 0, 24, 0, 0, 0, 'b'); - TextNTon := AddText(120, 240, 0, 24, 0, 0, 0, 'c'); - TextNText := AddText(120, 265, 0, 24, 0, 0, 0, 'd'); + //TextVideoGap := AddText(600, 265, 0, 24, 0, 0, 0, 'e'); // debug - TextDebug := AddText(30, 550, 0, 8, 0, 0, 0, ''); + TextDebug := AddText(30, 550, 0, 27, 0, 0, 0, ''); end; @@ -1358,8 +1572,8 @@ end; function TScreenEditSub.Draw: boolean; var Pet: integer; - AktBeat: integer; begin + glClearColor(1,1,1,1); // midi music @@ -1449,15 +1663,17 @@ begin Text[TextNText].Text := Text[TextNText].Text + '|'; // draw static menu - inherited Draw; - + DrawStatics; + DrawInfoBar(20, 460, 760, 20); + //inherited Draw; + DrawFG; // draw notes - SingDrawNoteLines(20, 300, 780, 15); + SingDrawNoteLines(20, 305, 780, 15); //Error Drawing when no Song is loaded if not Error then begin - SingDrawBeatDelimeters(40, 300, 760, 0); - EditDrawLine(40, 405, 760, 0, 15); + SingDrawBeatDelimeters(40, 305, 760, 0); + EditDrawLine(40, 410, 760, 0, 15); end; // draw text @@ -1517,4 +1733,4 @@ begin end; end; -end. +end. \ No newline at end of file -- cgit v1.2.3 From db313885eef67372bcbbca56173755f39b40ecfa Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 14 Mar 2010 20:01:10 +0000 Subject: editor: changed TextEditMode and some other improvements git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2196 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 44 +++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 3e7bd134..d15f2b19 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -91,6 +91,7 @@ type MidiLastNote: integer; TextEditMode: boolean; + editText: UTF8String; //backup of current text in text-edit-mode Lyric: TEditorLyrics; @@ -200,7 +201,8 @@ begin (SDL_ModState = KMOD_LSHIFT)); if (SResult = ssrOK) then begin - ScreenPopupInfo.ShowPopup(Language.Translate('INFO_FILE_SAVED')); + //ScreenPopupInfo.ShowPopup(Language.Translate('INFO_FILE_SAVED')); + Text[TextDebug].Text := Language.Translate('INFO_FILE_SAVED'); end else if (SResult = ssrEncodingError) then begin @@ -213,6 +215,20 @@ begin end; Exit; end; + + SDLK_R: //reload + begin + AudioPlayback.Stop; + {$IFDEF UseMIDIPort} + MidiOut.Close; + MidiOut.Free; + {$ENDIF} + Lyric.Free; + + onShow; + Text[TextDebug].Text := 'song reloaded'; //TODO: Language.Translate('SONG_RELOADED'); + end; + SDLK_D: begin // Divide lengths by 2 @@ -470,6 +486,7 @@ begin SDLK_F4: begin // Enter Text Edit Mode + editText := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; TextEditMode := true; end; @@ -706,15 +723,20 @@ begin begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text + UCS4ToUTF8String(CharCode); + + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; Exit; end; // check special keys case PressedKey of - SDLK_ESCAPE: begin - FadeTo(@ScreenSong); + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text := editText; + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; + TextEditMode := false; end; SDLK_F4, SDLK_RETURN: begin @@ -725,6 +747,8 @@ begin begin UTF8Delete(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text, LengthUTF8(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text), 1); + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; end; SDLK_RIGHT: begin @@ -737,6 +761,7 @@ begin CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; + editText := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; end; end; SDLK_LEFT: @@ -750,6 +775,7 @@ begin CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; Lyric.Selected := CurrentNote; + editText := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; end; end; end; @@ -1454,13 +1480,13 @@ begin SetLength(Player, 1); // line - AddText(40, 14, 1, 24, 0, 0, 0, 'Line:'); - TextSentence := AddText(110, 14, 1, 24, 0, 0, 0, '0 / 0'); + AddText(40, 11, 1, 30, 0, 0, 0, 'Line:'); + TextSentence := AddText(110, 11, 1, 30, 0, 0, 0, '0 / 0'); // Note - AddText(282, 14, 1, 24, 0, 0, 0, 'Note:'); - TextNote := AddText(360, 14, 1, 24, 0, 0, 0, '0 / 0'); + AddText(282, 11, 1, 30, 0, 0, 0, 'Note:'); + TextNote := AddText(360, 11, 1, 30, 0, 0, 0, '0 / 0'); // file info AddText(30, 65, 0, 24, 0, 0, 0, 'Title:'); @@ -1499,6 +1525,10 @@ var begin inherited; + AudioPlayback.Stop; + PlaySentence := false; + PlaySentenceMidi := false; + Log.LogStatus('Initializing', 'TEditScreen.OnShow'); Lyric := TEditorLyrics.Create; -- cgit v1.2.3 From e00075a45818a861c61416832985c316227dd420 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 14 Mar 2010 20:06:21 +0000 Subject: editor: deleted old midi debug entry git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2197 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index d15f2b19..6e9cbebf 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1561,8 +1561,6 @@ begin begin {$IFDEF UseMIDIPort} MidiOut := TMidiOutput.Create(nil); - if Ini.Debug = 1 then - MidiOut.ProductName := 'Microsoft GS Wavetable SW Synth'; // for my kxproject without midi table MidiOut.Open; {$ENDIF} Text[TextTitle].Text := CurrentSong.Title; -- cgit v1.2.3 From 578b9415aa600bdd5323784570edc0a96c605eb5 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 14 Mar 2010 20:56:20 +0000 Subject: fixed cover loading/showing when using tabs=on; deleted unused argument in SelectNext and SelectPrev git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2199 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 37 +++++++++++++++++++------------------ src/screens/UScreenSongJumpto.pas | 2 +- 2 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 7fda384c..fa45697b 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -130,8 +130,8 @@ type procedure GenerateThumbnails(); procedure OnShow; override; procedure OnHide; override; - procedure SelectNext(UnloadCover: boolean); - procedure SelectPrev(UnloadCover: boolean); + procedure SelectNext; + procedure SelectPrev; procedure SkipTo(Target: cardinal); procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix @@ -436,7 +436,7 @@ begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(I); - SelectNext(true); + SelectNext; FixSelected; break; end; @@ -464,7 +464,7 @@ begin ShowCatTL (I); CatSongs.ClickCategoryButton(I); - SelectNext(true); + SelectNext; // Fix: not existing song selected: //if (I + 1 = I2) then @@ -517,7 +517,7 @@ begin HideCatTL; //Show Wrong Song when Tabs on Fix - SelectNext(true); + SelectNext; FixSelected; //SelectPrev(true); //CatSongs.Song[0].Visible := false; @@ -536,7 +536,7 @@ begin Interaction := 0; //Show Wrong Song when Tabs on Fix - SelectNext(true); + SelectNext; FixSelected; end else @@ -574,7 +574,7 @@ begin // SetScroll4; //Show Wrong Song when Tabs on Fix - SelectNext(true); + SelectNext; FixSelected; end else @@ -631,7 +631,7 @@ begin ShowCatTL (Interaction); CatSongs.ClickCategoryButton(Interaction); - SelectNext(true); + SelectNext; FixSelected; //Play Music: @@ -673,7 +673,7 @@ begin ShowCatTL (I); CatSongs.ClickCategoryButton(I); - SelectNext(true); + SelectNext; FixSelected; //Play Music: @@ -689,7 +689,7 @@ begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin AudioPlayback.PlaySound(SoundLib.Change); - SelectNext(true); + SelectNext; SetScroll4; end; end; @@ -699,7 +699,7 @@ begin if (Songs.SongList.Count > 0)and (Mode = smNormal) then begin AudioPlayback.PlaySound(SoundLib.Change); - SelectPrev(true); + SelectPrev; SetScroll4; end; end; @@ -1512,7 +1512,7 @@ begin //If Playlist Shown -> Select Next automatically if (CatSongs.CatNumShow = -3) then begin - SelectNext(true); + SelectNext; end; end //Party Mode @@ -1652,7 +1652,7 @@ begin Result := true; end; -procedure TScreenSong.SelectNext(UnloadCover: boolean); +procedure TScreenSong.SelectNext; var Skip: integer; VS: integer; @@ -1665,7 +1665,8 @@ begin begin isScrolling := true; OnSongDeselect; - end; + end else if (VS=0) then // fix for tabs=on + UnLoadDetailedCover; Skip := 1; @@ -1691,7 +1692,7 @@ begin //Button[Interaction].Texture := Texture.GetTexture(Button[Interaction].Texture.Name, TEXTURE_TYPE_PLAIN, false); end; -procedure TScreenSong.SelectPrev(UnloadCover: boolean); +procedure TScreenSong.SelectPrev; var Skip: integer; VS: integer; @@ -1789,7 +1790,7 @@ begin SongTarget := 0; for i := 1 to Target+1 do - SelectNext(false); + SelectNext; FixSelected2; end; @@ -1823,7 +1824,7 @@ begin ShowCatTL(I); CatSongs.ClickCategoryButton(I); - SelectNext(true); + SelectNext; // choose song SkipTo(I2 - I); @@ -1838,7 +1839,7 @@ begin CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); ShowCatTL(PlaylistMan.CurPlayList); - SelectNext(true); + SelectNext; FixSelected2; SkipTo(Random(CatSongs.VisibleSongs)); diff --git a/src/screens/UScreenSongJumpto.pas b/src/screens/UScreenSongJumpto.pas index d0fa907a..b3d48679 100644 --- a/src/screens/UScreenSongJumpto.pas +++ b/src/screens/UScreenSongJumpto.pas @@ -229,7 +229,7 @@ begin //Fix SongSelection ScreenSong.Interaction := high(CatSongs.Song); - ScreenSong.SelectNext(true); + ScreenSong.SelectNext; ScreenSong.FixSelected; //Play Correct Music -- cgit v1.2.3 From 91d892149bdc487725e96a63aad8c37fc1f5798a Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Mon, 15 Mar 2010 19:18:19 +0000 Subject: fixed cover loading/showing when using tabs=on #2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2200 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index fa45697b..65f3c157 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1661,12 +1661,11 @@ begin if VS > 0 then begin - if (not isScrolling) and (VS > 1) then + if (not isScrolling) and (VS > 0) then begin isScrolling := true; OnSongDeselect; - end else if (VS=0) then // fix for tabs=on - UnLoadDetailedCover; + end; Skip := 1; @@ -1701,7 +1700,7 @@ begin if VS > 1 then begin - if (not isScrolling) and (VS > 1) then + if (not isScrolling) and (VS > 0) then begin isScrolling := true; OnSongDeselect; -- cgit v1.2.3 From ecaf172eeda812de19e1e93daa1b0fd27d6a4186 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Mon, 15 Mar 2010 21:14:51 +0000 Subject: bugfix: player selection on party player screen (the layout is still ugly) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2201 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenPartyPlayer.pas | 103 ++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 46 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenPartyPlayer.pas b/src/screens/UScreenPartyPlayer.pas index 3f9c0f77..a7f4d627 100644 --- a/src/screens/UScreenPartyPlayer.pas +++ b/src/screens/UScreenPartyPlayer.pas @@ -167,13 +167,17 @@ var begin repeat InteractNext; - until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible); + until ((Interactions[Interaction].Typ = iSelectS) and + SelectsS[Interactions[Interaction].Num].Visible) or + (Button[Interactions[Interaction].Num].Visible); end; procedure IntPrev; begin repeat InteractPrev; - until (Interactions[Interaction].Typ <> iButton) or (Button[Interactions[Interaction].Num].Visible); + until ((Interactions[Interaction].Typ = iSelectS) and + SelectsS[Interactions[Interaction].Num].Visible) or + (Button[Interactions[Interaction].Num].Visible); end; begin Result := true; @@ -184,8 +188,10 @@ begin else SDL_ModState := 0; - begin // Key Down - // check normal keys + // Key Down + // check normal keys + if (Interactions[Interaction].Typ = iButton) then + begin case CharCode of Ord('0')..Ord('9'), Ord('a')..Ord('z'), @@ -193,144 +199,149 @@ begin Ord(' '), Ord('-'), Ord('_'), Ord('!'), Ord(','), Ord('<'), Ord('/'), Ord('*'), Ord('?'), Ord(''''), Ord('"'): begin - Button[Interaction].Text[0].Text := Button[Interaction].Text[0].Text + - UCS4ToUTF8String(CharCode); + Button[Interactions[Interaction].Num].Text[0].Text := + Button[Interactions[Interaction].Num].Text[0].Text + UCS4ToUTF8String(CharCode); Exit; end; end; + // check special keys case PressedKey of // Templates for Names Mod SDLK_F1: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[0] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[0] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[0]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[0]; end; SDLK_F2: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[1] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[1] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[1]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[1]; end; SDLK_F3: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[2] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[2] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[2]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[2]; end; SDLK_F4: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[3] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[3] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[3]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[3]; end; SDLK_F5: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[4] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[4] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[4]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[4]; end; SDLK_F6: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[5] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[5] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[5]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[5]; end; SDLK_F7: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[6] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[6] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[6]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[6]; end; SDLK_F8: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[7] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[7] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[7]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[7]; end; SDLK_F9: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[8] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[8] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[8]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[8]; end; SDLK_F10: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[9] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[9] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[9]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[9]; end; SDLK_F11: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[10] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[10] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[10]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[10]; end; SDLK_F12: if (SDL_ModState = KMOD_LALT) then begin - Ini.NameTemplate[11] := Button[Interaction].Text[0].Text; + Ini.NameTemplate[11] := Button[Interactions[Interaction].Num].Text[0].Text; end else begin - Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; + Button[Interactions[Interaction].Num].Text[0].Text := Ini.NameTemplate[11]; end; SDLK_BACKSPACE: begin - Button[Interaction].Text[0].DeleteLastLetter; + Button[Interactions[Interaction].Num].Text[0].DeleteLastLetter; end; + end; + end; - SDLK_ESCAPE: - begin - Ini.SaveNames; - AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenPartyOptions); - end; + case PressedKey of + SDLK_ESCAPE: + begin + Ini.SaveNames; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenPartyOptions); + end; - SDLK_RETURN: UpdateParty; + SDLK_RETURN: UpdateParty; - // Up and Down could be done at the same time, - // but I don't want to declare variables inside - // functions like this one, called so many times - SDLK_DOWN: IntNext; - SDLK_UP: IntPrev; - SDLK_RIGHT: begin + // Up and Down could be done at the same time, + // but I don't want to declare variables inside + // functions like this one, called so many times + SDLK_DOWN: IntNext; + SDLK_UP: IntPrev; + SDLK_RIGHT: + begin if (Interaction in [0,2,8,14]) then begin AudioPlayback.PlaySound(SoundLib.Option); @@ -339,7 +350,8 @@ begin UpdateInterface; end; end; - SDLK_LEFT: begin + SDLK_LEFT: + begin if (Interaction in [0,2,8,14]) then begin AudioPlayback.PlaySound(SoundLib.Option); @@ -348,7 +360,6 @@ begin UpdateInterface; end; end; - end; end; end; -- cgit v1.2.3 From ffd76ba736eb429e7b79891f288b35fdde472e53 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Tue, 16 Mar 2010 19:25:13 +0000 Subject: some theme edits (option menu) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2203 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsAdvanced.pas | 2 +- src/screens/UScreenOptionsGame.pas | 2 +- src/screens/UScreenOptionsGraphics.pas | 2 +- src/screens/UScreenOptionsLyrics.pas | 2 +- src/screens/UScreenOptionsRecord.pas | 2 +- src/screens/UScreenOptionsSound.pas | 2 +- src/screens/UScreenOptionsThemes.pas | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 7a4ce15b..4998d3ec 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -154,7 +154,7 @@ begin AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/src/screens/UScreenOptionsGame.pas b/src/screens/UScreenOptionsGame.pas index caeaad6e..39de61e4 100644 --- a/src/screens/UScreenOptionsGame.pas +++ b/src/screens/UScreenOptionsGame.pas @@ -154,7 +154,7 @@ begin AddButton(Theme.OptionsGame.ButtonExit); if (Length(Button[0].Text) = 0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); end; diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index fc58626b..d719e637 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -151,7 +151,7 @@ begin AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); end; diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 0ef4e2a6..6d3aa082 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -134,7 +134,7 @@ begin AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); end; diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 828c20f6..b7a40676 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -323,7 +323,7 @@ begin // I uncommented the stuff above, because it's not skinable :X AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text) = 0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); // store InteractionID if (Length(AudioInputProcessor.DeviceList) > 0) then ExitButtonIID := MaxChannelCount + 2 diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index 7556dceb..cf4b5de4 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -173,7 +173,7 @@ begin AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); Interaction := 0; end; diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index dca581a2..3da859fd 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -176,7 +176,7 @@ begin AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then - AddButtonText(14, 20, Theme.Options.Description[7]); + AddButtonText(20, 5, Theme.Options.Description[7]); end; procedure TScreenOptionsThemes.OnShow; -- cgit v1.2.3 From 5ccfc5107ed4006fad3253dfd9041a42049a90d4 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 7 Apr 2010 11:49:45 +0000 Subject: swap textures of statics colorized to playercolor in score screen so ticket #1 should finally be fixed git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2221 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenScore.pas | 225 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 221 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 40fe8fbc..41954850 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -65,6 +65,8 @@ type Score_NoteBarLevel_Lightest: TTexture; // GoldenNotes Score_NoteBarRound_Lightest: TTexture; + + Player_Id_Box: TTexture; // boxes with player numbers end; TPlayerScoreScreenData = record // holds the positions and other data @@ -89,10 +91,8 @@ type APlayerPositionMap = array of TPlayerPositionMap; { textures for playerstatics of seconds screen players } - TPlayerStaticTexture = class - Tex: TTexture; - Player: integer; // 0..5 playernumber - + TPlayerStaticTexture = record + Tex: TTexture; end; TScreenScore = class(TMenu) @@ -129,17 +129,38 @@ type TextTotalScore: array[1..6] of integer; PlayerStatic: array[1..6] of array of integer; + { texture pairs for swapping when screens = 2 + first array level: index of player ( actually this is a position + 1 - Player 1 if PlayersPlay = 1 <- we don't need swapping here + 2..3 - Player 1 and 2 or 3 and 4 if PlayersPlay = 2 or 4 + 4..6 - Player 1 - 3 or 4 - 6 if PlayersPlay = 3 or 6 ) + second array level: different playerstatics for positions + third array level: texture for screen 1 or 2 } + PlayerStaticTextures: array[1..6] of array of array [1..2] of TPlayerStaticTexture; PlayerTexts: array[1..6] of array of integer; StaticBoxLightest: array[1..6] of integer; StaticBoxLight: array[1..6] of integer; StaticBoxDark: array[1..6] of integer; + { texture pairs for swapping when screens = 2 + for boxes + first array level: index of player ( actually this is a position + 1 - Player 1 if PlayersPlay = 1 <- we don't need swapping here + 2..3 - Player 1 and 2 or 3 and 4 if PlayersPlay = 2 or 4 + 4..6 - Player 1 - 3 or 4 - 6 if PlayersPlay = 3 or 6 ) + second array level: different boxes for positions (0: lightest; 1: light; 2: dark) + third array level: texture for screen 1 or 2 } + PlayerBoxTextures: array[1..6] of array[0..2] of array [1..2] of TPlayerStaticTexture; StaticBackLevel: array[1..6] of integer; StaticBackLevelRound: array[1..6] of integer; StaticLevel: array[1..6] of integer; StaticLevelRound: array[1..6] of integer; + { statics with players ids } + StaticPlayerIdBox: array[1..6] of integer; + TexturePlayerIdBox: array[1..6] of TTexture; + Animation: real; TextScore_ActualValue: array[1..6] of integer; @@ -168,6 +189,10 @@ type procedure ShowRating(PlayerNumber: integer); function CalculateBouncing(PlayerNumber: integer): real; procedure DrawRating(PlayerNumber: integer; Rating: integer); + + { for player static texture swapping } + procedure LoadSwapTextures; + procedure SwapToScreen(Screen: integer); public constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; @@ -185,6 +210,7 @@ uses UMenuStatic, UTime, UIni, + USkins, ULog, ULanguage, UNote, @@ -232,6 +258,188 @@ begin end; end; +procedure TScreenScore.LoadSwapTextures; + var + P, I: integer; + PlayerNum, PlayerNum2: integer; + Color: string; + R, G, B: real; + StaticNum: integer; + ThemeStatic: TThemeStatic; +begin + { we only need to load swapping textures if in dualscreen mode } + if Screens = 2 then + begin + { load swapping textures for custom statics } + for P := low(PlayerStatic) to High(PlayerStatic) do + begin + SetLength(PlayerStaticTextures[P], Length(PlayerStatic[P])); + + { get the players that actually are on this position } + case P of + 1: begin + PlayerNum := 1; + PlayerNum2 := 1; + end; + + 2, 3: begin + PlayerNum := P - 1; + PlayerNum2 := PlayerNum + 2; + end; + + 4..6: begin + PlayerNum := P - 3; + PlayerNum2 := PlayerNum + 3; + end; + end; + + for I := 0 to High(PlayerStatic[P]) do + begin + // copy current statics texture to texture for screen 1 + PlayerStaticTextures[P, I, 1].Tex := Static[PlayerStatic[P, I]].Texture; + + // fallback to first screen texture for 2nd screen + PlayerStaticTextures[P, I, 2].Tex := PlayerStaticTextures[P, I, 1].Tex; + + { texture for second screen } + { we only change color for statics with playercolor + and with Texture type colorized + also we don't need to swap for one player position } + if (P <> 1) and + (Theme.Score.PlayerStatic[P, I].Typ = Texture_Type_Colorized) and + (Length(Theme.Score.PlayerStatic[P, I].Color) >= 2) and + (copy(Theme.Score.PlayerStatic[P, I].Color, 1, 2) = 'P' + IntToStr(PlayerNum)) then + begin + // get the color + Color := Theme.Score.PlayerStatic[P, I].Color; + Color[2] := IntToStr(PlayerNum2)[1]; + LoadColor(R, G, B, Color); + + with Theme.Score.PlayerStatic[P, I] do + PlayerStaticTextures[P, I, 2].Tex := Texture.GetTexture(Skin.GetTextureFileName(Tex), Typ, RGBFloatToInt(R, G, B)); + + PlayerStaticTextures[P, I, 2].Tex.X := Static[PlayerStatic[P, I]].Texture.X; + PlayerStaticTextures[P, I, 2].Tex.Y := Static[PlayerStatic[P, I]].Texture.Y; + PlayerStaticTextures[P, I, 2].Tex.W := Static[PlayerStatic[P, I]].Texture.W; + PlayerStaticTextures[P, I, 2].Tex.H := Static[PlayerStatic[P, I]].Texture.H; + end; + end; + end; + + { load swap textures for boxes } + for P := low(PlayerBoxTextures) to High(PlayerBoxTextures) do + begin + { get the players that actually are on this position } + case P of + 1: begin + PlayerNum := 1; + PlayerNum2 := 1; + end; + + 2, 3: begin + PlayerNum := P - 1; + PlayerNum2 := PlayerNum + 2; + end; + + 4..6: begin + PlayerNum := P - 3; + PlayerNum2 := PlayerNum + 3; + end; + end; + + for I := 0 to High(PlayerBoxTextures[P]) do + begin + case I of + 0: begin + StaticNum := StaticBoxLightest[P]; + ThemeStatic := Theme.Score.StaticBoxLightest[P]; + end; + 1: begin + StaticNum := StaticBoxLight[P]; + ThemeStatic := Theme.Score.StaticBoxLight[P]; + end; + 2: begin + StaticNum := StaticBoxDark[P]; + ThemeStatic := Theme.Score.StaticBoxDark[P]; + end; + end; + // copy current statics texture to texture for screen 1 + PlayerBoxTextures[P, I, 1].Tex := Static[StaticNum].Texture; + + // fallback to first screen texture for 2nd screen + PlayerBoxTextures[P, I, 2].Tex := PlayerBoxTextures[P, I, 1].Tex; + + { texture for second screen } + { we only change color for statics with playercolor + and with Texture type colorized + also we don't need to swap for one player position } + if (P <> 1) and + (ThemeStatic.Typ = Texture_Type_Colorized) and + (Length(ThemeStatic.Color) >= 2) and + (copy(ThemeStatic.Color, 1, 2) = 'P' + IntToStr(PlayerNum)) then + begin + // get the color + Color := ThemeStatic.Color; + Color[2] := IntToStr(PlayerNum2)[1]; + LoadColor(R, G, B, Color); + + with ThemeStatic do + PlayerBoxTextures[P, I, 2].Tex := Texture.GetTexture(Skin.GetTextureFileName(Tex), Typ, RGBFloatToInt(R, G, B)); + + PlayerBoxTextures[P, I, 2].Tex.X := Static[StaticNum].Texture.X; + PlayerBoxTextures[P, I, 2].Tex.Y := Static[StaticNum].Texture.Y; + PlayerBoxTextures[P, I, 2].Tex.W := Static[StaticNum].Texture.W; + PlayerBoxTextures[P, I, 2].Tex.H := Static[StaticNum].Texture.H; + end; + end; + end; + end; +end; + +procedure TScreenScore.SwapToScreen(Screen: integer); + var + P, I: integer; +begin + { if screens = 2 and playerplay <= 3 the 2nd screen shows the + textures of screen 1 } + if (PlayersPlay <= 3) and (Screen = 2) then + Screen := 1; + + { set correct box textures } + for I := 0 to High(PlayerPositionMap) do + begin + if (PlayerPositionMap[I].Position > 0) and ((ScreenAct = PlayerPositionMap[I].Screen) or (PlayerPositionMap[I].BothScreens)) then + begin + // we just set the texture specific stuff + // so we don't overwrite e.g. width and height + with Static[StaticPlayerIdBox[PlayerPositionMap[I].Position]].Texture do + begin + TexNum := aPlayerScoreScreenTextures[I+1].Player_Id_Box.TexNum; + TexW := aPlayerScoreScreenTextures[I+1].Player_Id_Box.TexW; + TexH := aPlayerScoreScreenTextures[I+1].Player_Id_Box.TexH; + end; + end; + end; + + if (Screens = 2) then + begin + { to keep it simple we just swap all statics, not just the shown ones } + for P := Low(PlayerStatic) to High(PlayerStatic) do + for I := 0 to High(PlayerStatic[P]) do + begin + Static[PlayerStatic[P, I]].Texture := PlayerStaticTextures[P, I, Screen].Tex; + end; + + { box statics } + for P := Low(PlayerStatic) to High(PlayerStatic) do + begin + Static[StaticBoxLightest[P]].Texture := PlayerBoxTextures[P, 0, Screen].Tex; + Static[StaticBoxLight[P]].Texture := PlayerBoxTextures[P, 1, Screen].Tex; + Static[StaticBoxDark[P]].Texture := PlayerBoxTextures[P, 2, Screen].Tex; + end; + end; +end; + constructor TScreenScore.Create; var Player: integer; @@ -255,6 +463,8 @@ begin for Counter := 0 to High(Theme.Score.PlayerStatic[Player]) do PlayerStatic[Player, Counter] := AddStatic(Theme.Score.PlayerStatic[Player, Counter]); + + for Counter := 0 to High(Theme.Score.PlayerTexts[Player]) do PlayerTexts[Player, Counter] := AddText(Theme.Score.PlayerTexts[Player, Counter]); @@ -278,6 +488,7 @@ begin StaticBackLevelRound[Player] := AddStatic(Theme.Score.StaticBackLevelRound[Player]); StaticLevel[Player] := AddStatic(Theme.Score.StaticLevel[Player]); StaticLevelRound[Player] := AddStatic(Theme.Score.StaticLevelRound[Player]); + StaticPlayerIdBox[Player] := AddStatic(Theme.Score.StaticPlayerIdBox[Player]); //textures aPlayerScoreScreenTextures[Player].Score_NoteBarLevel_Dark := Tex_Score_NoteBarLevel_Dark[Player]; @@ -288,8 +499,10 @@ begin aPlayerScoreScreenTextures[Player].Score_NoteBarLevel_Lightest := Tex_Score_NoteBarLevel_Lightest[Player]; aPlayerScoreScreenTextures[Player].Score_NoteBarRound_Lightest := Tex_Score_NoteBarRound_Lightest[Player]; + aPlayerScoreScreenTextures[Player].Player_Id_Box := Texture.GetTexture(Skin.GetTextureFileName('PlayerIDBox0' + IntToStr(Player)), Texture_Type_Transparent); end; + LoadSwapTextures; end; procedure TScreenScore.MapPlayersToPosition; @@ -495,6 +708,8 @@ begin Static[StaticBoxLight[P]].Visible := V[P]; Static[StaticBoxDark[P]].Visible := V[P]; + Static[StaticPlayerIdBox[P]].Visible := V[P]; + // we draw that on our own Static[StaticBackLevel[P]].Visible := false; Static[StaticBackLevelRound[P]].Visible := false; @@ -536,6 +751,8 @@ begin player[1].ScoreGoldenInt := 900; player[1].ScoreTotalInt := 4500; //*} + // swap static textures to current screen ones + SwapToScreen(ScreenAct); //Draw the Background DrawBG; -- cgit v1.2.3 From 962f21e84feb128c650c0478a6f7af337dacaee6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 15 Apr 2010 17:57:15 +0000 Subject: - port theme detection code from UIni to UThemes - load new value DefaultSkin from themefiles - load value Color (skins default color) from skinfiles - use default skin and color on first start - use default skin and color on theme/skin change git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2241 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsThemes.pas | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 3da859fd..591b0fb2 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -137,6 +137,15 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions(Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + // set skin to themes default skin + Ini.SkinNo := Theme.Themes[Ini.Theme].DefaultSkin; + end; + + { set skins default color } + if (SelInteraction = 0) or (SelInteraction = 1) then + begin + Ini.Color := Skin.GetDefaultColor(Ini.SkinNo); end; ReloadTheme(); @@ -151,6 +160,15 @@ begin begin Skin.OnThemeChange; UpdateSelectSlideOptions (Theme.OptionsThemes.SelectSkin, SkinSelect, ISkin, Ini.SkinNo); + + // set skin to themes default skin + Ini.SkinNo := Theme.Themes[Ini.Theme].DefaultSkin; + end; + + { set skins default color } + if (SelInteraction = 0) or (SelInteraction = 1) then + begin + Ini.Color := Skin.GetDefaultColor(Ini.SkinNo); end; ReloadTheme(); @@ -188,7 +206,7 @@ end; procedure TScreenOptionsThemes.ReloadTheme; begin - Theme.LoadTheme(ThemePath.Append(ITheme[Ini.Theme] + '.ini'), Ini.Color); + Theme.LoadTheme(Ini.Theme, Ini.Color); ScreenOptionsThemes := TScreenOptionsThemes.create(); ScreenOptionsThemes.onshow; -- cgit v1.2.3 From f761eb20ce8d3b5ef718be4a305b78712641248d Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 18 Apr 2010 13:43:36 +0000 Subject: change variable names "static" to "statics" - "static" is a reserved name and should not be used - code-completion in lazarus does not work as it is not able to cope with variables that are named "static" git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2246 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEdit.pas | 4 +- src/screens/UScreenEditHeader.pas | 56 ++++++++--------- src/screens/UScreenMain.pas | 4 +- src/screens/UScreenPartyNewRound.pas | 28 ++++----- src/screens/UScreenPartyScore.pas | 82 ++++++++++++------------- src/screens/UScreenPartyWin.pas | 78 ++++++++++++------------ src/screens/UScreenScore.pas | 68 ++++++++++----------- src/screens/UScreenSing.pas | 36 +++++------ src/screens/UScreenSong.pas | 114 +++++++++++++++++------------------ src/screens/UScreenTop5.pas | 20 +++--- 10 files changed, 245 insertions(+), 245 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEdit.pas b/src/screens/UScreenEdit.pas index 2111adef..12e2948c 100644 --- a/src/screens/UScreenEdit.pas +++ b/src/screens/UScreenEdit.pas @@ -157,8 +157,8 @@ end; procedure TScreenEdit.SetAnimationProgress(Progress: real); begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; + Statics[0].Texture.ScaleW := Progress; + Statics[0].Texture.ScaleH := Progress; end; end. diff --git a/src/screens/UScreenEditHeader.pas b/src/screens/UScreenEditHeader.pas index c581215b..1d697bc9 100644 --- a/src/screens/UScreenEditHeader.pas +++ b/src/screens/UScreenEditHeader.pas @@ -349,90 +349,90 @@ end;*) procedure TScreenEditHeader.SetRoundButtons; begin if Length(Text[TextTitle].Text) > 0 then - Static[StaticTitle].Visible := true + Statics[StaticTitle].Visible := true else - Static[StaticTitle].Visible := false; + Statics[StaticTitle].Visible := false; if Length(Text[TextArtist].Text) > 0 then - Static[StaticArtist].Visible := true + Statics[StaticArtist].Visible := true else - Static[StaticArtist].Visible := false; + Statics[StaticArtist].Visible := false; if Length(Text[TextMp3].Text) > 0 then - Static[StaticMp3].Visible := true + Statics[StaticMp3].Visible := true else - Static[StaticMp3].Visible := false; + Statics[StaticMp3].Visible := false; if Length(Text[TextBackground].Text) > 0 then - Static[StaticBackground].Visible := true + Statics[StaticBackground].Visible := true else - Static[StaticBackground].Visible := false; + Statics[StaticBackground].Visible := false; if Length(Text[TextVideo].Text) > 0 then - Static[StaticVideo].Visible := true + Statics[StaticVideo].Visible := true else - Static[StaticVideo].Visible := false; + Statics[StaticVideo].Visible := false; try StrToFloat(Text[TextVideoGAP].Text); if StrToFloat(Text[TextVideoGAP].Text)<> 0 then - Static[StaticVideoGAP].Visible := true + Statics[StaticVideoGAP].Visible := true else - Static[StaticVideoGAP].Visible := false; + Statics[StaticVideoGAP].Visible := false; except - Static[StaticVideoGAP].Visible := false; + Statics[StaticVideoGAP].Visible := false; end; if LowerCase(Text[TextRelative].Text) = 'yes' then - Static[StaticRelative].Visible := true + Statics[StaticRelative].Visible := true else - Static[StaticRelative].Visible := false; + Statics[StaticRelative].Visible := false; try StrToInt(Text[TextResolution].Text); if (StrToInt(Text[TextResolution].Text) <> 0) and (StrToInt(Text[TextResolution].Text) >= 1) then - Static[StaticResolution].Visible := true + Statics[StaticResolution].Visible := true else - Static[StaticResolution].Visible := false; + Statics[StaticResolution].Visible := false; except - Static[StaticResolution].Visible := false; + Statics[StaticResolution].Visible := false; end; try StrToInt(Text[TextNotesGAP].Text); - Static[StaticNotesGAP].Visible := true; + Statics[StaticNotesGAP].Visible := true; except - Static[StaticNotesGAP].Visible := false; + Statics[StaticNotesGAP].Visible := false; end; // start try StrToFloat(Text[TextStart].Text); if (StrToFloat(Text[TextStart].Text) > 0) then - Static[StaticStart].Visible := true + Statics[StaticStart].Visible := true else - Static[StaticStart].Visible := false; + Statics[StaticStart].Visible := false; except - Static[StaticStart].Visible := false; + Statics[StaticStart].Visible := false; end; // GAP try StrToFloat(Text[TextGAP].Text); - Static[StaticGAP].Visible := true; + Statics[StaticGAP].Visible := true; except - Static[StaticGAP].Visible := false; + Statics[StaticGAP].Visible := false; end; // BPM try StrToFloat(Text[TextBPM].Text); if (StrToFloat(Text[TextBPM].Text) > 0) then - Static[StaticBPM].Visible := true + Statics[StaticBPM].Visible := true else - Static[StaticBPM].Visible := false; + Statics[StaticBPM].Visible := false; except - Static[StaticBPM].Visible := false; + Statics[StaticBPM].Visible := false; end; end; diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 8bdfe419..2973fbb9 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -259,8 +259,8 @@ end; procedure TScreenMain.SetAnimationProgress(Progress: real); begin - Static[0].Texture.ScaleW := Progress; - Static[0].Texture.ScaleH := Progress; + Statics[0].Texture.ScaleW := Progress; + Statics[0].Texture.ScaleH := Progress; end; end. diff --git a/src/screens/UScreenPartyNewRound.pas b/src/screens/UScreenPartyNewRound.pas index 6a1c8e69..8024108c 100644 --- a/src/screens/UScreenPartyNewRound.pas +++ b/src/screens/UScreenPartyNewRound.pas @@ -215,7 +215,7 @@ begin begin if (I <= High(Party.Rounds)) then begin - Static[StaticRound[I]].Visible := True; + Statics[StaticRound[I]].Visible := True; Text[TextRound[I]].Visible := True; Text[TextWinner[I]].Visible := True; @@ -225,7 +225,7 @@ begin end else begin - Static[StaticRound[I]].Visible := False; + Statics[StaticRound[I]].Visible := False; Text[TextRound[I]].Visible := False; Text[TextWinner[I]].Visible := False; end; @@ -242,16 +242,16 @@ begin Text[TextScoreTeam1].Visible := true; Text[TextNameTeam1].Visible := true; Text[TextTeam1Players].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticNextPlayer1].Visible := true; + Statics[StaticTeam1].Visible := true; + Statics[StaticNextPlayer1].Visible := true; end else begin Text[TextScoreTeam1].Visible := false; Text[TextNameTeam1].Visible := false; Text[TextTeam1Players].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticNextPlayer1].Visible := false; + Statics[StaticTeam1].Visible := false; + Statics[StaticNextPlayer1].Visible := false; end; if (Length(Party.Teams) >= 2) then @@ -263,16 +263,16 @@ begin Text[TextScoreTeam2].Visible := true; Text[TextNameTeam2].Visible := true; Text[TextTeam2Players].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticNextPlayer2].Visible := true; + Statics[StaticTeam2].Visible := true; + Statics[StaticNextPlayer2].Visible := true; end else begin Text[TextScoreTeam2].Visible := false; Text[TextNameTeam2].Visible := false; Text[TextTeam2Players].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticNextPlayer2].Visible := false; + Statics[StaticTeam2].Visible := false; + Statics[StaticNextPlayer2].Visible := false; end; if (Length(Party.Teams) >= 3) then @@ -284,16 +284,16 @@ begin Text[TextScoreTeam3].Visible := true; Text[TextNameTeam3].Visible := true; Text[TextTeam3Players].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticNextPlayer3].Visible := true; + Statics[StaticTeam3].Visible := true; + Statics[StaticNextPlayer3].Visible := true; end else begin Text[TextScoreTeam3].Visible := false; Text[TextNameTeam3].Visible := false; Text[TextTeam3Players].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticNextPlayer3].Visible := false; + Statics[StaticTeam3].Visible := false; + Statics[StaticNextPlayer3].Visible := false; end; //nextRound Texts diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 3bfca4a8..32ca5db2 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -208,15 +208,15 @@ begin Ranking := Party.Rounds[Party.CurrentRound].Ranking; - {//Set Static Length - Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; - Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; - Static[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; + {//Set Statics Length + Statics[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + Statics[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + Statics[StaticTeam3].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100; - //fix: prevents static from drawn out of bounds. - if Static[StaticTeam1].Texture.ScaleW > 99 then Static[StaticTeam1].Texture.ScaleW := 99; - if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; - if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; } + //fix: prevents statics from drawn out of bounds. + if Statics[StaticTeam1].Texture.ScaleW > 99 then Statics[StaticTeam1].Texture.ScaleW := 99; + if Statics[StaticTeam2].Texture.ScaleW > 99 then Statics[StaticTeam2].Texture.ScaleW := 99; + if Statics[StaticTeam3].Texture.ScaleW > 99 then Statics[StaticTeam3].Texture.ScaleW := 99; } //Set Winnertext Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [Party.GetWinnerString(Party.CurrentRound)]); @@ -231,26 +231,26 @@ begin begin if (Length(Ranking) >= 1) and (Ranking[0].Rank >= 1) and (Ranking[0].Rank <= Length(DecoTex)) then begin - Static[StaticTeam1Deco].Texture.TexNum := DecoTex[Ranking[0].Rank-1]; - Static[StaticTeam1Deco].Texture.ColR := DecoColor[Ranking[0].Rank-1].R; - Static[StaticTeam1Deco].Texture.ColG := DecoColor[Ranking[0].Rank-1].G; - Static[StaticTeam1Deco].Texture.ColB := DecoColor[Ranking[0].Rank-1].B; + Statics[StaticTeam1Deco].Texture.TexNum := DecoTex[Ranking[0].Rank-1]; + Statics[StaticTeam1Deco].Texture.ColR := DecoColor[Ranking[0].Rank-1].R; + Statics[StaticTeam1Deco].Texture.ColG := DecoColor[Ranking[0].Rank-1].G; + Statics[StaticTeam1Deco].Texture.ColB := DecoColor[Ranking[0].Rank-1].B; end; end; Text[TextScoreTeam1].Visible := true; Text[TextNameTeam1].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticTeam1BG].Visible := true; - Static[StaticTeam1Deco].Visible := true; + Statics[StaticTeam1].Visible := true; + Statics[StaticTeam1BG].Visible := true; + Statics[StaticTeam1Deco].Visible := true; end else begin Text[TextScoreTeam1].Visible := false; Text[TextNameTeam1].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticTeam1BG].Visible := false; - Static[StaticTeam1Deco].Visible := false; + Statics[StaticTeam1].Visible := false; + Statics[StaticTeam1BG].Visible := false; + Statics[StaticTeam1Deco].Visible := false; end; if (Length(Party.Teams) >= 2) then @@ -263,26 +263,26 @@ begin begin if (Length(Ranking) >= 2) and (Ranking[1].Rank >= 1) and (Ranking[1].Rank <= Length(DecoTex)) then begin - Static[StaticTeam2Deco].Texture.TexNum := DecoTex[Ranking[1].Rank-1]; - Static[StaticTeam2Deco].Texture.ColR := DecoColor[Ranking[1].Rank-1].R; - Static[StaticTeam2Deco].Texture.ColG := DecoColor[Ranking[1].Rank-1].G; - Static[StaticTeam2Deco].Texture.ColB := DecoColor[Ranking[1].Rank-1].B; + Statics[StaticTeam2Deco].Texture.TexNum := DecoTex[Ranking[1].Rank-1]; + Statics[StaticTeam2Deco].Texture.ColR := DecoColor[Ranking[1].Rank-1].R; + Statics[StaticTeam2Deco].Texture.ColG := DecoColor[Ranking[1].Rank-1].G; + Statics[StaticTeam2Deco].Texture.ColB := DecoColor[Ranking[1].Rank-1].B; end; end; Text[TextScoreTeam2].Visible := true; Text[TextNameTeam2].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticTeam2BG].Visible := true; - Static[StaticTeam2Deco].Visible := true; + Statics[StaticTeam2].Visible := true; + Statics[StaticTeam2BG].Visible := true; + Statics[StaticTeam2Deco].Visible := true; end else begin Text[TextScoreTeam2].Visible := false; Text[TextNameTeam2].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticTeam2BG].Visible := false; - Static[StaticTeam2Deco].Visible := false; + Statics[StaticTeam2].Visible := false; + Statics[StaticTeam2BG].Visible := false; + Statics[StaticTeam2Deco].Visible := false; end; if (Length(Party.Teams) >= 3) then @@ -295,37 +295,37 @@ begin begin if (Length(Ranking) >= 3) and (Ranking[2].Rank >= 1) and (Ranking[2].Rank <= Length(DecoTex)) then begin - Static[StaticTeam3Deco].Texture.TexNum := DecoTex[Ranking[2].Rank-1]; - Static[StaticTeam3Deco].Texture.ColR := DecoColor[Ranking[2].Rank-1].R; - Static[StaticTeam3Deco].Texture.ColG := DecoColor[Ranking[2].Rank-1].G; - Static[StaticTeam3Deco].Texture.ColB := DecoColor[Ranking[2].Rank-1].B; + Statics[StaticTeam3Deco].Texture.TexNum := DecoTex[Ranking[2].Rank-1]; + Statics[StaticTeam3Deco].Texture.ColR := DecoColor[Ranking[2].Rank-1].R; + Statics[StaticTeam3Deco].Texture.ColG := DecoColor[Ranking[2].Rank-1].G; + Statics[StaticTeam3Deco].Texture.ColB := DecoColor[Ranking[2].Rank-1].B; end; end; Text[TextScoreTeam3].Visible := true; Text[TextNameTeam3].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticTeam3BG].Visible := true; - Static[StaticTeam3Deco].Visible := true; + Statics[StaticTeam3].Visible := true; + Statics[StaticTeam3BG].Visible := true; + Statics[StaticTeam3Deco].Visible := true; end else begin Text[TextScoreTeam3].Visible := false; Text[TextNameTeam3].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticTeam3BG].Visible := false; - Static[StaticTeam3Deco].Visible := false; + Statics[StaticTeam3].Visible := false; + Statics[StaticTeam3BG].Visible := false; + Statics[StaticTeam3Deco].Visible := false; end; end; procedure TScreenPartyScore.SetAnimationProgress(Progress: real); begin {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then - Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; + Statics[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then - Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; + Statics[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then - Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;} + Statics[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Percentage / 100;} end; end. diff --git a/src/screens/UScreenPartyWin.pas b/src/screens/UScreenPartyWin.pas index d9fd26d4..ed8d017c 100644 --- a/src/screens/UScreenPartyWin.pas +++ b/src/screens/UScreenPartyWin.pas @@ -159,9 +159,9 @@ begin Text[TextScoreTeam1].Visible := true; Text[TextNameTeam1].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticTeam1BG].Visible := true; - Static[StaticTeam1Deco].Visible := true; + Statics[StaticTeam1].Visible := true; + Statics[StaticTeam1BG].Visible := true; + Statics[StaticTeam1Deco].Visible := true; //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then @@ -169,9 +169,9 @@ begin I := GetTeamColor(Ranking[0].Team); if (I <> -1) then begin - Static[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam1BG].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam1BG].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam1BG].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam1BG].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam1BG].Texture.ColB := Color[I].RGB.B; end; end; @@ -180,9 +180,9 @@ begin I := GetTeamColor(Ranking[0].Team); if (I <> -1) then begin - Static[StaticTeam1].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam1].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam1].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam1].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam1].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam1].Texture.ColB := Color[I].RGB.B; end; end; end @@ -190,9 +190,9 @@ begin begin Text[TextScoreTeam1].Visible := false; Text[TextNameTeam1].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticTeam1BG].Visible := false; - Static[StaticTeam1Deco].Visible := false; + Statics[StaticTeam1].Visible := false; + Statics[StaticTeam1BG].Visible := false; + Statics[StaticTeam1Deco].Visible := false; end; if (Length(Party.Teams) >= 2) then @@ -202,9 +202,9 @@ begin Text[TextScoreTeam2].Visible := true; Text[TextNameTeam2].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticTeam2BG].Visible := true; - Static[StaticTeam2Deco].Visible := true; + Statics[StaticTeam2].Visible := true; + Statics[StaticTeam2BG].Visible := true; + Statics[StaticTeam2Deco].Visible := true; //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then @@ -212,9 +212,9 @@ begin I := GetTeamColor(Ranking[1].Team); if (I <> -1) then begin - Static[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam2BG].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam2BG].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam2BG].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam2BG].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam2BG].Texture.ColB := Color[I].RGB.B; end; end; @@ -223,9 +223,9 @@ begin I := GetTeamColor(Ranking[1].Team); if (I <> -1) then begin - Static[StaticTeam2].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam2].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam2].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam2].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam2].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam2].Texture.ColB := Color[I].RGB.B; end; end; end @@ -233,9 +233,9 @@ begin begin Text[TextScoreTeam2].Visible := false; Text[TextNameTeam2].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticTeam2BG].Visible := false; - Static[StaticTeam2Deco].Visible := false; + Statics[StaticTeam2].Visible := false; + Statics[StaticTeam2BG].Visible := false; + Statics[StaticTeam2Deco].Visible := false; end; if (Length(Party.Teams) >= 3) then @@ -245,9 +245,9 @@ begin Text[TextScoreTeam3].Visible := true; Text[TextNameTeam3].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticTeam3BG].Visible := true; - Static[StaticTeam3Deco].Visible := true; + Statics[StaticTeam3].Visible := true; + Statics[StaticTeam3BG].Visible := true; + Statics[StaticTeam3Deco].Visible := true; //Set Static Color to Team Color if (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then @@ -255,9 +255,9 @@ begin I := GetTeamColor(Ranking[2].Team); if (I <> -1) then begin - Static[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam3BG].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam3BG].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam3BG].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam3BG].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam3BG].Texture.ColB := Color[I].RGB.B; end; end; @@ -266,9 +266,9 @@ begin I := GetTeamColor(Ranking[2].Team); if (I <> -1) then begin - Static[StaticTeam3].Texture.ColR := Color[I].RGB.R; - Static[StaticTeam3].Texture.ColG := Color[I].RGB.G; - Static[StaticTeam3].Texture.ColB := Color[I].RGB.B; + Statics[StaticTeam3].Texture.ColR := Color[I].RGB.R; + Statics[StaticTeam3].Texture.ColG := Color[I].RGB.G; + Statics[StaticTeam3].Texture.ColB := Color[I].RGB.B; end; end; end @@ -276,20 +276,20 @@ begin begin Text[TextScoreTeam3].Visible := false; Text[TextNameTeam3].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticTeam3BG].Visible := false; - Static[StaticTeam3Deco].Visible := false; + Statics[StaticTeam3].Visible := false; + Statics[StaticTeam3BG].Visible := false; + Statics[StaticTeam3Deco].Visible := false; end; end; procedure TScreenPartyWin.SetAnimationProgress(Progress: real); begin {if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then - Static[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Score / maxScore; + Statics[StaticTeam1].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[0].Score / maxScore; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then - Static[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Score / maxScore; + Statics[StaticTeam2].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[1].Score / maxScore; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then - Static[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Score / maxScore;} + Statics[StaticTeam3].Texture.ScaleW := Progress * ScreenSingModi.PlayerInfo.Playerinfo[2].Score / maxScore;} end; end. diff --git a/src/screens/UScreenScore.pas b/src/screens/UScreenScore.pas index 41954850..de7675bf 100644 --- a/src/screens/UScreenScore.pas +++ b/src/screens/UScreenScore.pas @@ -296,7 +296,7 @@ begin for I := 0 to High(PlayerStatic[P]) do begin // copy current statics texture to texture for screen 1 - PlayerStaticTextures[P, I, 1].Tex := Static[PlayerStatic[P, I]].Texture; + PlayerStaticTextures[P, I, 1].Tex := Statics[PlayerStatic[P, I]].Texture; // fallback to first screen texture for 2nd screen PlayerStaticTextures[P, I, 2].Tex := PlayerStaticTextures[P, I, 1].Tex; @@ -318,10 +318,10 @@ begin with Theme.Score.PlayerStatic[P, I] do PlayerStaticTextures[P, I, 2].Tex := Texture.GetTexture(Skin.GetTextureFileName(Tex), Typ, RGBFloatToInt(R, G, B)); - PlayerStaticTextures[P, I, 2].Tex.X := Static[PlayerStatic[P, I]].Texture.X; - PlayerStaticTextures[P, I, 2].Tex.Y := Static[PlayerStatic[P, I]].Texture.Y; - PlayerStaticTextures[P, I, 2].Tex.W := Static[PlayerStatic[P, I]].Texture.W; - PlayerStaticTextures[P, I, 2].Tex.H := Static[PlayerStatic[P, I]].Texture.H; + PlayerStaticTextures[P, I, 2].Tex.X := Statics[PlayerStatic[P, I]].Texture.X; + PlayerStaticTextures[P, I, 2].Tex.Y := Statics[PlayerStatic[P, I]].Texture.Y; + PlayerStaticTextures[P, I, 2].Tex.W := Statics[PlayerStatic[P, I]].Texture.W; + PlayerStaticTextures[P, I, 2].Tex.H := Statics[PlayerStatic[P, I]].Texture.H; end; end; end; @@ -364,7 +364,7 @@ begin end; end; // copy current statics texture to texture for screen 1 - PlayerBoxTextures[P, I, 1].Tex := Static[StaticNum].Texture; + PlayerBoxTextures[P, I, 1].Tex := Statics[StaticNum].Texture; // fallback to first screen texture for 2nd screen PlayerBoxTextures[P, I, 2].Tex := PlayerBoxTextures[P, I, 1].Tex; @@ -386,10 +386,10 @@ begin with ThemeStatic do PlayerBoxTextures[P, I, 2].Tex := Texture.GetTexture(Skin.GetTextureFileName(Tex), Typ, RGBFloatToInt(R, G, B)); - PlayerBoxTextures[P, I, 2].Tex.X := Static[StaticNum].Texture.X; - PlayerBoxTextures[P, I, 2].Tex.Y := Static[StaticNum].Texture.Y; - PlayerBoxTextures[P, I, 2].Tex.W := Static[StaticNum].Texture.W; - PlayerBoxTextures[P, I, 2].Tex.H := Static[StaticNum].Texture.H; + PlayerBoxTextures[P, I, 2].Tex.X := Statics[StaticNum].Texture.X; + PlayerBoxTextures[P, I, 2].Tex.Y := Statics[StaticNum].Texture.Y; + PlayerBoxTextures[P, I, 2].Tex.W := Statics[StaticNum].Texture.W; + PlayerBoxTextures[P, I, 2].Tex.H := Statics[StaticNum].Texture.H; end; end; end; @@ -412,7 +412,7 @@ begin begin // we just set the texture specific stuff // so we don't overwrite e.g. width and height - with Static[StaticPlayerIdBox[PlayerPositionMap[I].Position]].Texture do + with Statics[StaticPlayerIdBox[PlayerPositionMap[I].Position]].Texture do begin TexNum := aPlayerScoreScreenTextures[I+1].Player_Id_Box.TexNum; TexW := aPlayerScoreScreenTextures[I+1].Player_Id_Box.TexW; @@ -427,15 +427,15 @@ begin for P := Low(PlayerStatic) to High(PlayerStatic) do for I := 0 to High(PlayerStatic[P]) do begin - Static[PlayerStatic[P, I]].Texture := PlayerStaticTextures[P, I, Screen].Tex; + Statics[PlayerStatic[P, I]].Texture := PlayerStaticTextures[P, I, Screen].Tex; end; { box statics } for P := Low(PlayerStatic) to High(PlayerStatic) do begin - Static[StaticBoxLightest[P]].Texture := PlayerBoxTextures[P, 0, Screen].Tex; - Static[StaticBoxLight[P]].Texture := PlayerBoxTextures[P, 1, Screen].Tex; - Static[StaticBoxDark[P]].Texture := PlayerBoxTextures[P, 2, Screen].Tex; + Statics[StaticBoxLightest[P]].Texture := PlayerBoxTextures[P, 0, Screen].Tex; + Statics[StaticBoxLight[P]].Texture := PlayerBoxTextures[P, 1, Screen].Tex; + Statics[StaticBoxDark[P]].Texture := PlayerBoxTextures[P, 2, Screen].Tex; end; end; end; @@ -685,9 +685,9 @@ begin Text[TextGoldenNotesScore[P]].Alpha := 0; Text[TextTotal[P]].Alpha := 0; Text[TextTotalScore[P]].Alpha := 0; - Static[StaticBoxLightest[P]].Texture.Alpha := 0; - Static[StaticBoxLight[P]].Texture.Alpha := 0; - Static[StaticBoxDark[P]].Texture.Alpha := 0; + Statics[StaticBoxLightest[P]].Texture.Alpha := 0; + Statics[StaticBoxLight[P]].Texture.Alpha := 0; + Statics[StaticBoxDark[P]].Texture.Alpha := 0; Text[TextNotes[P]].Visible := V[P]; Text[TextNotesScore[P]].Visible := V[P]; @@ -699,22 +699,22 @@ begin Text[TextTotalScore[P]].Visible := V[P]; for I := 0 to high(PlayerStatic[P]) do - Static[PlayerStatic[P, I]].Visible := V[P]; + Statics[PlayerStatic[P, I]].Visible := V[P]; for I := 0 to high(PlayerTexts[P]) do Text[PlayerTexts[P, I]].Visible := V[P]; - Static[StaticBoxLightest[P]].Visible := V[P]; - Static[StaticBoxLight[P]].Visible := V[P]; - Static[StaticBoxDark[P]].Visible := V[P]; + Statics[StaticBoxLightest[P]].Visible := V[P]; + Statics[StaticBoxLight[P]].Visible := V[P]; + Statics[StaticBoxDark[P]].Visible := V[P]; - Static[StaticPlayerIdBox[P]].Visible := V[P]; + Statics[StaticPlayerIdBox[P]].Visible := V[P]; // we draw that on our own - Static[StaticBackLevel[P]].Visible := false; - Static[StaticBackLevelRound[P]].Visible := false; - Static[StaticLevel[P]].Visible := false; - Static[StaticLevelRound[P]].Visible := false; + Statics[StaticBackLevel[P]].Visible := false; + Statics[StaticBackLevelRound[P]].Visible := false; + Statics[StaticLevel[P]].Visible := false; + Statics[StaticLevelRound[P]].Visible := false; end; BarScore_EaseOut_Step := 1; @@ -775,8 +775,8 @@ begin (* //todo: i need a clever method to draw statics with their z value - for I := 0 to Length(Static) - 1 do - Static[I].Draw; + for I := 0 to Length(Statics) - 1 do + Statics[I].Draw; for I := 0 to Length(Text) - 1 do Text[I].Draw; *) @@ -799,21 +799,21 @@ begin Text[TextGoldenNotesScore[ThemeIndex]].Text := IntToStr(TextGolden_ActualValue[PlayerNumber]); Text[TextGoldenNotesScore[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); - Static[StaticBoxLightest[ThemeIndex]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); + Statics[StaticBoxLightest[ThemeIndex]].Texture.Alpha := (BarGolden_EaseOut_Step / 100); Text[TextGoldenNotes[ThemeIndex]].Alpha := (BarGolden_EaseOut_Step / 100); // line bonus Text[TextLineBonusScore[ThemeIndex]].Text := IntToStr(TextPhrase_ActualValue[PlayerNumber]); Text[TextLineBonusScore[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); - Static[StaticBoxLight[ThemeIndex]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); + Statics[StaticBoxLight[ThemeIndex]].Texture.Alpha := (BarPhrase_EaseOut_Step / 100); Text[TextLineBonus[ThemeIndex]].Alpha := (BarPhrase_EaseOut_Step / 100); // plain score Text[TextNotesScore[ThemeIndex]].Text := IntToStr(TextScore_ActualValue[PlayerNumber]); Text[TextNotes[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); - Static[StaticBoxDark[ThemeIndex]].Texture.Alpha := (BarScore_EaseOut_Step / 100); + Statics[StaticBoxDark[ThemeIndex]].Texture.Alpha := (BarScore_EaseOut_Step / 100); Text[TextNotesScore[ThemeIndex]].Alpha := (BarScore_EaseOut_Step / 100); // total score @@ -1078,8 +1078,8 @@ begin glEnable(GL_BLEND); glBegin(GL_QUADS); - glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Static[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); - glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Static[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(0, 0); glVertex3f(BarStartPosX, (BarStartPosY - Statics[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); + glTexCoord2f(1, 0); glVertex3f(BarStartPosX + Width, (BarStartPosY - Statics[StaticLevelRound[ThemeIndex]].Texture.h) - NewHeight, ZBars); glTexCoord2f(1, 1); glVertex3f(BarStartPosX + Width, BarStartPosY - NewHeight, ZBars); glTexCoord2f(0, 1); glVertex3f(BarStartPosX, BarStartPosY - NewHeight, ZBars); glEnd; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 18496517..74c09b4f 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -322,7 +322,7 @@ begin StaticPausePopup := AddStatic(Theme.Sing.PausePopUp); // pausepopup is not visibile at the beginning - Static[StaticPausePopup].Visible := false; + Statics[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, @@ -428,24 +428,24 @@ begin end; // this one is shown in 1P mode - Static[StaticP1].Visible := V1; + Statics[StaticP1].Visible := V1; Text[TextP1].Visible := V1; // this one is shown in 2/4P mode - Static[StaticP1TwoP].Visible := V1TwoP; + Statics[StaticP1TwoP].Visible := V1TwoP; Text[TextP1TwoP].Visible := V1TwoP; - Static[StaticP2R].Visible := V2R; + Statics[StaticP2R].Visible := V2R; Text[TextP2R].Visible := V2R; // this one is shown in 3/6P mode - Static[StaticP1ThreeP].Visible := V1ThreeP; + Statics[StaticP1ThreeP].Visible := V1ThreeP; Text[TextP1ThreeP].Visible := V1ThreeP; - Static[StaticP2M].Visible := V2M; + Statics[StaticP2M].Visible := V2M; Text[TextP2M].Visible := V2M; - Static[StaticP3R].Visible := V3R; + Statics[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; // FIXME: sets path and filename to '' @@ -763,23 +763,23 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff. Commenting this stuff out, nothing // was missing on screen w/ 6 players - so do we even need this stuff? - {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10 * ScreenX; + {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX; Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } - {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X + 10*ScreenX; + {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - {Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10 * ScreenX; + {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } - {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} // end of weird stuff { - Static[1].Texture.X := Static[1].Texture.X + 10 * ScreenX; } + Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; } { for T := 0 to 1 do Text[T].X := Text[T].X + 10 * ScreenX; } @@ -870,15 +870,15 @@ begin // will move the statics and texts to the correct screen here. // FIXME: clean up this weird stuff - {Static[StaticP1].Texture.X := Static[StaticP1].Texture.X - 10 * ScreenX; + {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX; Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; - Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10 * ScreenX; + Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; // end of weird - Static[1].Texture.X := Static[1].Texture.X - 10 * ScreenX; + Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX; for T := 0 to 1 do Text[T].X := Text[T].X - 10 * ScreenX; } @@ -888,9 +888,9 @@ begin // maybe someone could find a better solution if Paused then begin - Static[StaticPausePopup].Visible := true; - Static[StaticPausePopup].Draw; - Static[StaticPausePopup].Visible := false; + Statics[StaticPausePopup].Visible := true; + Statics[StaticPausePopup].Draw; + Statics[StaticPausePopup].Visible := false; end; Result := true; diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 65f3c157..a3c5f36a 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -224,7 +224,7 @@ procedure TScreenSong.ShowCatTLCustom(Caption: UTF8String);// Show Custom Text i begin Text[TextCat].Text := Caption; Text[TextCat].Visible := true; - Static[StaticCat].Visible := false; + Statics[StaticCat].Visible := false; end; //Show Cat in Top Left Mod @@ -232,18 +232,18 @@ procedure TScreenSong.ShowCatTL(Cat: integer); begin //Change Text[TextCat].Text := CatSongs.Song[Cat].Artist; - //Static[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); + //Statics[StaticCat].Texture := Texture.GetTexture(Button[Cat].Texture.Name, TEXTURE_TYPE_PLAIN, true); //Show Text[TextCat].Visible := true; - Static[StaticCat].Visible := true; + Statics[StaticCat].Visible := true; end; procedure TScreenSong.HideCatTL; begin //Hide //Text[TextCat].Visible := false; - Static[StaticCat].Visible := false; + Statics[StaticCat].Visible := false; //New -> Show Text specified in Theme Text[TextCat].Visible := true; Text[TextCat].Text := Theme.Song.TextCat.Text; @@ -991,7 +991,7 @@ begin end; // Set visibility of video icon - Static[VideoIcon].Visible := CatSongs.Song[Interaction].Video.IsSet; + Statics[VideoIcon].Visible := CatSongs.Song[Interaction].Video.IsSet; // Set texts Text[TextArtist].Text := CatSongs.Song[Interaction].Artist; @@ -1176,7 +1176,7 @@ begin end; if Length(Button) > 0 then - Static[1].Texture.Y := Button[Interaction].Y - 5; // selection texture + Statics[1].Texture.Y := Button[Interaction].Y - 5; // selection texture end; procedure TScreenSong.SetScroll2; @@ -1638,8 +1638,8 @@ begin Button[I].Draw; // Statics - for I := 0 to Length(Static) - 1 do - Static[I].Draw; + for I := 0 to Length(Statics) - 1 do + Statics[I].Draw; // and texts for I := 0 to Length(Text) - 1 do @@ -1863,74 +1863,74 @@ begin begin if (Length(Party.Teams) >= 1) then begin - Static[StaticTeam1Joker1].Visible := (Party.Teams[0].JokersLeft >= 1); - Static[StaticTeam1Joker2].Visible := (Party.Teams[0].JokersLeft >= 2); - Static[StaticTeam1Joker3].Visible := (Party.Teams[0].JokersLeft >= 3); - Static[StaticTeam1Joker4].Visible := (Party.Teams[0].JokersLeft >= 4); - Static[StaticTeam1Joker5].Visible := (Party.Teams[0].JokersLeft >= 5); + Statics[StaticTeam1Joker1].Visible := (Party.Teams[0].JokersLeft >= 1); + Statics[StaticTeam1Joker2].Visible := (Party.Teams[0].JokersLeft >= 2); + Statics[StaticTeam1Joker3].Visible := (Party.Teams[0].JokersLeft >= 3); + Statics[StaticTeam1Joker4].Visible := (Party.Teams[0].JokersLeft >= 4); + Statics[StaticTeam1Joker5].Visible := (Party.Teams[0].JokersLeft >= 5); end else begin - Static[StaticTeam1Joker1].Visible := false; - Static[StaticTeam1Joker2].Visible := false; - Static[StaticTeam1Joker3].Visible := false; - Static[StaticTeam1Joker4].Visible := false; - Static[StaticTeam1Joker5].Visible := false; + Statics[StaticTeam1Joker1].Visible := false; + Statics[StaticTeam1Joker2].Visible := false; + Statics[StaticTeam1Joker3].Visible := false; + Statics[StaticTeam1Joker4].Visible := false; + Statics[StaticTeam1Joker5].Visible := false; end; if (Length(Party.Teams) >= 2) then begin - Static[StaticTeam2Joker1].Visible := (Party.Teams[1].JokersLeft >= 1); - Static[StaticTeam2Joker2].Visible := (Party.Teams[1].JokersLeft >= 2); - Static[StaticTeam2Joker3].Visible := (Party.Teams[1].JokersLeft >= 3); - Static[StaticTeam2Joker4].Visible := (Party.Teams[1].JokersLeft >= 4); - Static[StaticTeam2Joker5].Visible := (Party.Teams[1].JokersLeft >= 5); + Statics[StaticTeam2Joker1].Visible := (Party.Teams[1].JokersLeft >= 1); + Statics[StaticTeam2Joker2].Visible := (Party.Teams[1].JokersLeft >= 2); + Statics[StaticTeam2Joker3].Visible := (Party.Teams[1].JokersLeft >= 3); + Statics[StaticTeam2Joker4].Visible := (Party.Teams[1].JokersLeft >= 4); + Statics[StaticTeam2Joker5].Visible := (Party.Teams[1].JokersLeft >= 5); end else begin - Static[StaticTeam2Joker1].Visible := false; - Static[StaticTeam2Joker2].Visible := false; - Static[StaticTeam2Joker3].Visible := false; - Static[StaticTeam2Joker4].Visible := false; - Static[StaticTeam2Joker5].Visible := false; + Statics[StaticTeam2Joker1].Visible := false; + Statics[StaticTeam2Joker2].Visible := false; + Statics[StaticTeam2Joker3].Visible := false; + Statics[StaticTeam2Joker4].Visible := false; + Statics[StaticTeam2Joker5].Visible := false; end; if (Length(Party.Teams) >= 3) then begin - Static[StaticTeam3Joker1].Visible := (Party.Teams[2].JokersLeft >= 1); - Static[StaticTeam3Joker2].Visible := (Party.Teams[2].JokersLeft >= 2); - Static[StaticTeam3Joker3].Visible := (Party.Teams[2].JokersLeft >= 3); - Static[StaticTeam3Joker4].Visible := (Party.Teams[2].JokersLeft >= 4); - Static[StaticTeam3Joker5].Visible := (Party.Teams[2].JokersLeft >= 5); + Statics[StaticTeam3Joker1].Visible := (Party.Teams[2].JokersLeft >= 1); + Statics[StaticTeam3Joker2].Visible := (Party.Teams[2].JokersLeft >= 2); + Statics[StaticTeam3Joker3].Visible := (Party.Teams[2].JokersLeft >= 3); + Statics[StaticTeam3Joker4].Visible := (Party.Teams[2].JokersLeft >= 4); + Statics[StaticTeam3Joker5].Visible := (Party.Teams[2].JokersLeft >= 5); end else begin - Static[StaticTeam3Joker1].Visible := false; - Static[StaticTeam3Joker2].Visible := false; - Static[StaticTeam3Joker3].Visible := false; - Static[StaticTeam3Joker4].Visible := false; - Static[StaticTeam3Joker5].Visible := false; + Statics[StaticTeam3Joker1].Visible := false; + Statics[StaticTeam3Joker2].Visible := false; + Statics[StaticTeam3Joker3].Visible := false; + Statics[StaticTeam3Joker4].Visible := false; + Statics[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; + Statics[StaticTeam1Joker1].Visible := false; + Statics[StaticTeam1Joker2].Visible := false; + Statics[StaticTeam1Joker3].Visible := false; + Statics[StaticTeam1Joker4].Visible := false; + Statics[StaticTeam1Joker5].Visible := false; + + Statics[StaticTeam2Joker1].Visible := false; + Statics[StaticTeam2Joker2].Visible := false; + Statics[StaticTeam2Joker3].Visible := false; + Statics[StaticTeam2Joker4].Visible := false; + Statics[StaticTeam2Joker5].Visible := false; + + Statics[StaticTeam3Joker1].Visible := false; + Statics[StaticTeam3Joker2].Visible := false; + Statics[StaticTeam3Joker3].Visible := false; + Statics[StaticTeam3Joker4].Visible := false; + Statics[StaticTeam3Joker5].Visible := false; end; end; @@ -1943,7 +1943,7 @@ begin Visible := (Mode = smPartyMode); for I := 0 to High(StaticParty) do - Static[StaticParty[I]].Visible := Visible; + Statics[StaticParty[I]].Visible := Visible; for I := 0 to High(TextParty) do Text[TextParty[I]].Visible := Visible; @@ -1952,7 +1952,7 @@ begin Visible := not Visible; for I := 0 to High(StaticNonParty) do - Static[StaticNonParty[I]].Visible := Visible; + Statics[StaticNonParty[I]].Visible := Visible; for I := 0 to High(TextNonParty) do Text[TextNonParty[I]].Visible := Visible; diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 2ddff713..705d1e35 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -203,7 +203,7 @@ begin for I := 1 to Length(CurrentSong.Score[Ini.Difficulty]) do begin - Static[StaticNumber[I]].Visible := true; + Statics[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; @@ -216,7 +216,7 @@ begin for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do begin - Static[StaticNumber[I]].Visible := false; + Statics[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; Text[TextScore[I]].Visible := false; @@ -232,7 +232,7 @@ var begin for I := 1 to Length(CurrentSong.Score[difficulty]) do begin - Static[StaticNumber[I]].Visible := true; + Statics[StaticNumber[I]].Visible := true; Text[TextNumber[I]].Visible := true; Text[TextName[I]].Visible := true; Text[TextScore[I]].Visible := true; @@ -245,7 +245,7 @@ begin for I := Length(CurrentSong.Score[difficulty]) + 1 to 5 do begin - Static[StaticNumber[I]].Visible := false; + Statics[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; Text[TextName[I]].Visible := false; Text[TextScore[I]].Visible := false; @@ -282,18 +282,18 @@ begin if ScreenAct = 1 then begin LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, + Statics[StaticBoxLightest[Item]].Texture.ColR, + Statics[StaticBoxLightest[Item]].Texture.ColG, + Statics[StaticBoxLightest[Item]].Texture.ColB, 'P1Dark'); end; if ScreenAct = 2 then begin LoadColor( - Static[StaticBoxLightest[Item]].Texture.ColR, - Static[StaticBoxLightest[Item]].Texture.ColG, - Static[StaticBoxLightest[Item]].Texture.ColB, + Statics[StaticBoxLightest[Item]].Texture.ColR, + Statics[StaticBoxLightest[Item]].Texture.ColG, + Statics[StaticBoxLightest[Item]].Texture.ColB, 'P4Dark'); end; } -- cgit v1.2.3 From 868ce765441473e7d1fec9b3ad22a707f121a637 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 18:27:36 +0000 Subject: - add video loop option - allow multiple instances of a video git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2260 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 69 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 74c09b4f..5f39ec49 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -105,7 +105,8 @@ type SungToEnd: boolean; fShowVisualization: boolean; - fCurrentVideoPlaybackEngine: IVideoPlayback; + fCurrentVideo: IVideo; + fVideoClip: IVideo; // some settings to be set by plugins settings: record @@ -179,13 +180,14 @@ begin fShowVisualization := not fShowVisualization; if fShowVisualization then - fCurrentVideoPlaybackEngine := Visualization + begin + fCurrentVideo := Visualization.Open(PATH_NONE); + fCurrentVideo.play; + end else - fCurrentVideoPlaybackEngine := VideoPlayback; - - if fShowVisualization then - fCurrentVideoPlaybackEngine.play; - + begin + fCurrentVideo := fVideoClip; + end; Exit; end; Ord('P'): @@ -216,7 +218,7 @@ begin SDLK_TAB: // change visualization preset begin if fShowVisualization then - fCurrentVideoPlaybackEngine.Position := now; // move to a random position + fCurrentVideo.Position := now; // move to a random position end; SDLK_RETURN: @@ -254,7 +256,7 @@ begin // pause video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; end else // disable pause @@ -267,7 +269,7 @@ begin // video VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.Exists then - fCurrentVideoPlaybackEngine.Pause; + fCurrentVideo.Pause; Paused := false; end; @@ -283,7 +285,7 @@ begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; + fCurrentVideo := nil; // create score class Scores := TSingScores.Create; @@ -358,8 +360,8 @@ begin ClearSettings; Party.CallBeforeSing; - // reset video playback engine, to play Video Clip... - fCurrentVideoPlaybackEngine := VideoPlayback; + // reset video playback engine + fCurrentVideo := nil; // setup score manager Scores.ClearPlayers; // clear old player values @@ -480,10 +482,6 @@ begin Exit; end; - // reset video playback engine, to play video clip ... - fCurrentVideoPlaybackEngine.Close; - fCurrentVideoPlaybackEngine := VideoPlayback; - {* * == Background == * We have four types of backgrounds: @@ -503,12 +501,13 @@ begin VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.IsFile then begin - if (fCurrentVideoPlaybackEngine.Open(VideoFile)) then + fVideoClip := VideoPlayback.Open(VideoFile); + fCurrentVideo := fVideoClip; + if (fVideoClip <> nil) then begin fShowVisualization := false; - fCurrentVideoPlaybackEngine := VideoPlayback; - fCurrentVideoPlaybackEngine.Position := CurrentSong.VideoGAP + CurrentSong.Start; - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo.Position := CurrentSong.VideoGAP + CurrentSong.Start; + fCurrentVideo.Play; VideoLoaded := true; end; end; @@ -538,9 +537,9 @@ begin if (TVisualizerOption(Ini.VisualizerOption) in [voOn]) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; {* @@ -550,9 +549,9 @@ begin (VideoLoaded = false)) then begin fShowVisualization := true; - fCurrentVideoPlaybackEngine := Visualization; - if (fCurrentVideoPlaybackEngine <> nil) then - fCurrentVideoPlaybackEngine.Play; + fCurrentVideo := Visualization.Open(PATH_NONE); + if (fCurrentVideo <> nil) then + fCurrentVideo.Play; end; // prepare lyrics timer @@ -815,14 +814,14 @@ begin // update and draw movie if (ShowFinish and (VideoLoaded or fShowVisualization)) then begin - if assigned(fCurrentVideoPlaybackEngine) then + if assigned(fCurrentVideo) then begin // Just call this once // when Screens = 2 if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + fCurrentVideo.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); + fCurrentVideo.DrawGL(ScreenAct); end; end; @@ -902,15 +901,13 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); - if (VideoPlayback <> nil) then - VideoPlayback.Close; - - if (Visualization <> nil) then - Visualization.Close; - // to prevent drawing closed video VideoLoaded := false; + // close video files + fVideoClip := nil; + fCurrentVideo := nil; + // kill all stars and effects GoldenRec.KillAll; -- cgit v1.2.3 From deba59815a59cc6857c72872b7ae5d6d332bcb48 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 19:17:12 +0000 Subject: major bug-fix: - TScreenSong.OnHide() interfered with TScreenSing.OnShow() method as the changes of AudioPlayback in TScreenSing.OnShow() were overwritten by TScreenSong.OnHide() which is called later. -> moved AudioPlayback initialization to OnShowFinish - The audio file was opened in TScreenSong, mainly that caused the interference. Now the audio file is opened in TScreenSing. This looks more cleaner too. - this patch fixes: - some race conditions - Dead Smiling Pirates song (and others) were not played from the beginning (especially on linux) cleanup: - removed unused MusicPreviewTimer git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2262 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 17 ++++++++++------- src/screens/UScreenSong.pas | 16 ++-------------- 2 files changed, 12 insertions(+), 21 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5f39ec49..5000d096 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -564,12 +564,6 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); - // prepare music - AudioPlayback.Stop(); - AudioPlayback.Position := CurrentSong.Start; - // synchronize music to the lyrics - AudioPlayback.SetSyncSource(LyricsSync); - // prepare and start voice-capture AudioInput.CaptureStart; @@ -666,7 +660,16 @@ procedure TScreenSing.onShowFinish; begin // hide cursor on singscreen show Display.SetCursor; - + + // prepare music + // Important: AudioPlayback must not be initialized in onShow() as TScreenSong + // uses stops AudioPlayback in onHide() which interferes with TScreenSings onShow. + AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); + AudioPlayback.SetVolume(1.0); + AudioPlayback.Position := CurrentSong.Start; + // synchronize music to the lyrics + AudioPlayback.SetSyncSource(LyricsSync); + // start lyrics LyricsState.Resume(); diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a3c5f36a..34589963 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -81,7 +81,6 @@ type HighSpeed: boolean; CoverFull: boolean; CoverTime: real; - MusicPreviewTimer: PSDL_TimerID; CoverX: integer; CoverY: integer; @@ -1534,19 +1533,11 @@ end; procedure TScreenSong.OnHide; begin - // if preview is not loaded: load musicfile now; not on cat-main! - if (PreviewOpened <> Interaction) and not CatSongs.Song[Interaction].main then - AudioPlayback.Open(CatSongs.Song[Interaction].Path.Append(CatSongs.Song[Interaction].Mp3)); - // turn music volume to 100% AudioPlayback.SetVolume(1.0); - // if hide then stop music (for party mode popup on exit) - if (Display.NextScreen <> @ScreenSing) {and - (Display.NextScreen <> @ScreenSingModi) }then - begin - StopMusicPreview(); - end; + // stop preview + StopMusicPreview(); end; procedure TScreenSong.DrawExtensions; @@ -1766,9 +1757,6 @@ end; procedure TScreenSong.StopMusicPreview(); begin - // Cancel pending preview requests - SDL_RemoveTimer(MusicPreviewTimer); - // Stop preview of previous song AudioPlayback.Stop; end; -- cgit v1.2.3 From 898eb68e995d88f3e64040b7db08ab158159abe1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Wed, 21 Apr 2010 21:38:54 +0000 Subject: - already show first video frame at sing-screen at onShow (no white screen) - removed some obsolete vars git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2268 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 62 ++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 5000d096..269ef201 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -60,12 +60,14 @@ type type TScreenSing = class(TMenu) + private + fShowVisualization: boolean; + fCurrentVideo: IVideo; + fVideoClip: IVideo; + fLyricsSync: TLyricsSyncSource; protected - VideoLoaded: boolean; eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow - protected Paused: boolean; //pause Mod - LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; public // timebar fields @@ -104,12 +106,8 @@ type //the song was sung to the end SungToEnd: boolean; - fShowVisualization: boolean; - fCurrentVideo: IVideo; - fVideoClip: IVideo; - // some settings to be set by plugins - settings: record + Settings: record Finish: Boolean; //< if true, screen will finish on next draw LyricsVisible: Boolean; //< shows or hides lyrics @@ -240,8 +238,6 @@ end; // pause mod procedure TScreenSing.Pause; -var - VideoFile: IPath; begin if (not Paused) then // enable pause begin @@ -254,8 +250,7 @@ begin AudioPlayback.Pause; // pause video - VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.Exists then + if (fCurrentVideo <> nil) then fCurrentVideo.Pause; end @@ -267,8 +262,7 @@ begin AudioPlayback.Play; // video - VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.Exists then + if (fCurrentVideo <> nil) then fCurrentVideo.Pause; Paused := false; @@ -330,7 +324,7 @@ begin Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); - LyricsSync := TLyricsSyncSource.Create(); + fLyricsSync := TLyricsSyncSource.Create(); eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); @@ -496,7 +490,6 @@ begin {* * set background to: video *} - VideoLoaded := false; fShowVisualization := false; VideoFile := CurrentSong.Path.Append(CurrentSong.Video); if (CurrentSong.Video.IsSet) and VideoFile.IsFile then @@ -508,14 +501,13 @@ begin fShowVisualization := false; fCurrentVideo.Position := CurrentSong.VideoGAP + CurrentSong.Start; fCurrentVideo.Play; - VideoLoaded := true; end; end; {* * set background to: picture *} - if (CurrentSong.Background.IsSet) and (VideoLoaded = false) + if (CurrentSong.Background.IsSet) and (fVideoClip = nil) and (TVisualizerOption(Ini.VisualizerOption) = voOff) then begin BgFile := CurrentSong.Path.Append(CurrentSong.Background); @@ -546,7 +538,7 @@ begin * set background to: visualization (Videos are still shown) *} if ((TVisualizerOption(Ini.VisualizerOption) in [voWhenNoVideo]) and - (VideoLoaded = false)) then + (fVideoClip = nil)) then begin fShowVisualization := true; fCurrentVideo := Visualization.Open(PATH_NONE); @@ -668,7 +660,7 @@ begin AudioPlayback.SetVolume(1.0); AudioPlayback.Position := CurrentSong.Start; // synchronize music to the lyrics - AudioPlayback.SetSyncSource(LyricsSync); + AudioPlayback.SetSyncSource(fLyricsSync); // start lyrics LyricsState.Resume(); @@ -718,6 +710,7 @@ var Sec: integer; T: integer; CurLyricsTime: real; + VideoFrameTime: Extended; Line: TLyricLine; LastWord: TLyricWord; begin @@ -815,17 +808,27 @@ begin end; // update and draw movie - if (ShowFinish and (VideoLoaded or fShowVisualization)) then + if Assigned(fCurrentVideo) then begin - if assigned(fCurrentVideo) then + // Just call this once + // when Screens = 2 + if (ScreenAct = 1) then begin - // Just call this once - // when Screens = 2 - if (ScreenAct = 1) then - fCurrentVideo.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - - fCurrentVideo.DrawGL(ScreenAct); + if (ShowFinish) then + begin + // everything is setup, determine the current position + VideoFrameTime := CurrentSong.VideoGAP + LyricsState.GetCurrentTime(); + end + else + begin + // Important: do not yet start the triggered timer by a call to + // LyricsState.GetCurrentTime() + VideoFrameTime := CurrentSong.VideoGAP; + end; + fCurrentVideo.GetFrame(VideoFrameTime); end; + + fCurrentVideo.DrawGL(ScreenAct); end; // draw static menu (FG) @@ -904,9 +907,6 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); - // to prevent drawing closed video - VideoLoaded := false; - // close video files fVideoClip := nil; fCurrentVideo := nil; -- cgit v1.2.3 From edfc692c991e08af0163aa6812e5972478d7191b Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 22 Apr 2010 01:04:24 +0000 Subject: - now it is possible to sync lyrics to audio - ini option SyncTo added - lyric to audio is default now (instead of sync audio to lyrics) - modified RelativeTimer (hopefully easier to use and more self-explanatory) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2273 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 269ef201..e4764760 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -58,6 +58,10 @@ type function GetClock(): real; override; end; + TMusicSyncSource = class(TSyncSource) + function GetClock(): real; override; + end; + type TScreenSing = class(TMenu) private @@ -65,6 +69,7 @@ type fCurrentVideo: IVideo; fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; + fMusicSync: TMusicSyncSource; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -256,7 +261,7 @@ begin end else // disable pause begin - LyricsState.Resume(); + LyricsState.Start(); // play music AudioPlayback.Play; @@ -325,6 +330,7 @@ begin Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); fLyricsSync := TLyricsSyncSource.Create(); + fMusicSync := TMusicSyncSource.Create(); eSongLoaded := THookableEvent.Create('ScreenSing.SongLoaded'); @@ -659,11 +665,21 @@ begin AudioPlayback.Open(CurrentSong.Path.Append(CurrentSong.Mp3)); AudioPlayback.SetVolume(1.0); AudioPlayback.Position := CurrentSong.Start; - // synchronize music to the lyrics - AudioPlayback.SetSyncSource(fLyricsSync); + + // synchronize music + if (Ini.SyncTo = Ord(stLyrics)) then + AudioPlayback.SetSyncSource(fLyricsSync) + else + AudioPlayback.SetSyncSource(nil); + + // synchronize lyrics (do not set this before AudioPlayback is initialized) + if (Ini.SyncTo = Ord(stMusic)) then + LyricsState.SetSyncSource(fMusicSync) + else + LyricsState.SetSyncSource(nil); // start lyrics - LyricsState.Resume(); + LyricsState.Start(true); // start music AudioPlayback.Play(); @@ -907,6 +923,9 @@ begin AudioPlayback.Stop; AudioPlayback.SetSyncSource(nil); + LyricsState.Stop(); + LyricsState.SetSyncSource(nil); + // close video files fVideoClip := nil; fCurrentVideo := nil; @@ -1045,5 +1064,10 @@ begin Result := LyricsState.GetCurrentTime(); end; +function TMusicSyncSource.GetClock(): real; +begin + Result := AudioPlayback.Position; +end; + end. -- cgit v1.2.3 From 69cf82185e7f559d8858b44fa76379c771acc6b6 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 23 Apr 2010 22:39:26 +0000 Subject: - font fallback added - more configurable fonts.ini - ftNormal/ftBold/ftOutline1/2 added git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2293 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index e4764760..233f1e38 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -591,7 +591,7 @@ begin case Ini.LyricsFont of 0: // normal fonts begin - Lyrics.FontStyle := 0; + Lyrics.FontStyle := ftNormal; Lyrics.LineColor_en.R := Skin_FontR; Lyrics.LineColor_en.G := Skin_FontG; @@ -608,9 +608,12 @@ begin Lyrics.LineColor_act.B := 0.8; Lyrics.LineColor_act.A := 1; end; - 1, 2: // outline fonts (is TScalableOutlineFont) + 1, 2: // outline fonts begin - Lyrics.FontStyle := Ini.LyricsFont + 1; + if (Ini.LyricsFont = 1) then + Lyrics.FontStyle := ftOutline1 + else + Lyrics.FontStyle := ftOutline2; Lyrics.LineColor_en.R := 0.75; Lyrics.LineColor_en.G := 0.75; -- cgit v1.2.3 From 03abb1fddd189e796fde9d8a334a78ee99d9885f Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 28 Apr 2010 15:31:10 +0000 Subject: improved cover flow: only five front covers and 3 covers in the back that show up in the gap between the front cover and its neighbors are drawn. This looks more beauty than the old solution and it should fix the massive performance loss when many songs are in the shown category. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2314 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 34589963..a4fde5f6 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1344,13 +1344,19 @@ begin Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); Button[B].Z := 0.95 - Abs(Pos) * 0.01; end - else + { only draw 3 visible covers in the background + (the 3 that are on the opposite of the front covers} + else if (Abs(Pos) > floor(VS/2) - 1.5) then begin - // Transform Pos to range [-1..-1/2, +1/2..+1] + // Transform Pos to range [-1..-3/4, +3/4..+1] + { the 3 covers at the back will show up in the gap between the + front cover and its neighbors + one cover will be hiddenbehind the front cover, + but this will not be a lack of performance ;) } if Pos < 0 then - Pos := Pos/VS - 0.5 + Pos := (Pos - 2 + ceil(VS/2))/8 - 0.75 else - Pos := Pos/VS + 0.5; + Pos := (Pos + 2 - floor(VS/2))/8 + 0.75; // angle in radians [-2Pi..-Pi, +Pi..+2Pi] Angle := 2*Pi * Pos; @@ -1366,7 +1372,10 @@ begin //Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - end; + end + { all other covers are not visible } + else + Button[B].Visible := false; end; end; end; -- cgit v1.2.3 From d250481c0c591dd935a08841debe41b7892ff040 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 2 May 2010 15:51:44 +0000 Subject: workaround for LCTRL+R in SongMenu: it should be changed when we have a solution for the CTRL+'A'..'Z' problem git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2331 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a4fde5f6..a9aed0f1 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -338,6 +338,13 @@ begin Exit; end; + // ********************** + // * workaround for LCTRL+R: it should be changed when we have a solution for the + // * CTRL+'A'..'Z' problem + if (SDL_ModState = KMOD_LCTRL) and (PressedKey = SDLK_R) then + CharCode := UCS4Char('R'); + // ********************** + // check normal keys case UCS4UpperCase(CharCode) of Ord('Q'): -- cgit v1.2.3 From 9db515c0d4c878f16405002a3c640939a237153e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 3 May 2010 21:51:46 +0000 Subject: ESC saves again. revert 1183. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2335 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsThemes.pas | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 591b0fb2..94475cc7 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -84,7 +84,12 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - // Escape -> save nothing - just leave this screen + Ini.Save; + + // Reload all screens, after Theme changed + // Todo : JB - Check if theme was actually changed + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens(); AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); -- cgit v1.2.3 From 6470ff97f46c3681546ff2a04bbe85b9cdb4bda2 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 3 May 2010 21:53:12 +0000 Subject: ESC saves again. revert 1183. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2336 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsSound.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsSound.pas b/src/screens/UScreenOptionsSound.pas index cf4b5de4..c0efa4d8 100644 --- a/src/screens/UScreenOptionsSound.pas +++ b/src/screens/UScreenOptionsSound.pas @@ -78,7 +78,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - // Escape -> save nothing - just leave this screen + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; -- cgit v1.2.3 From 35eb211b76dfa47b761541c81fb82a2e8fa770ed Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 3 May 2010 21:55:18 +0000 Subject: ESC saves again. revert 1183. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2337 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsLyrics.pas | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsLyrics.pas b/src/screens/UScreenOptionsLyrics.pas index 6d3aa082..468082de 100644 --- a/src/screens/UScreenOptionsLyrics.pas +++ b/src/screens/UScreenOptionsLyrics.pas @@ -76,8 +76,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - // Escape -> save nothing - just leave this screen - + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; -- cgit v1.2.3 From f40c3b34bc54791a1313e4fc2047b08554c8c59d Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Mon, 3 May 2010 21:58:30 +0000 Subject: ESC saves again. revert 1183. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2338 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsAdvanced.pas | 3 +-- src/screens/UScreenOptionsGraphics.pas | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsAdvanced.pas b/src/screens/UScreenOptionsAdvanced.pas index 4998d3ec..dd727dd8 100644 --- a/src/screens/UScreenOptionsAdvanced.pas +++ b/src/screens/UScreenOptionsAdvanced.pas @@ -76,8 +76,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - // Escape -> save nothing - just leave this screen - + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; diff --git a/src/screens/UScreenOptionsGraphics.pas b/src/screens/UScreenOptionsGraphics.pas index d719e637..e2aacccd 100644 --- a/src/screens/UScreenOptionsGraphics.pas +++ b/src/screens/UScreenOptionsGraphics.pas @@ -76,8 +76,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - // Escape -> save nothing - just leave this screen - + Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); end; -- cgit v1.2.3 From 71083e94848dc0516d164a36453617231c912e77 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 7 May 2010 15:50:51 +0000 Subject: fix coverflow "SetScroll5" for less than 8 songs remove workaround (use SetScroll4 instead of 5) for less than 5 songs git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2340 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index a9aed0f1..6b83d522 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -986,12 +986,7 @@ begin // Set Positions case Theme.Song.Cover.Style of 3: SetScroll3; - 5:begin - if VS > 5 then - SetScroll5 - else - SetScroll4; - end; + 5: SetScroll5; 6: SetScroll6; else SetScroll4; end; @@ -1336,7 +1331,7 @@ begin // Use an alternate position for the five front covers. if (Abs(Pos) < 2.5) then begin - Angle := Pi * (Pos / 5); // Range: (-1/4*Pi .. +1/4*Pi) + Angle := Pi * (Pos / Min(VS, 5)); // Range: (-1/4*Pi .. +1/4*Pi) Button[B].H := Abs(Theme.Song.Cover.H * cos(Angle*0.8)); Button[B].W := Button[B].H; @@ -1350,10 +1345,15 @@ begin Button[B].X := Theme.Song.Cover.X + Theme.Song.Cover.W * X - Padding; Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); Button[B].Z := 0.95 - Abs(Pos) * 0.01; + + if VS < 5 then + Button[B].Texture.Alpha := 1 - Abs(Pos) / VS * 2 + else + Button[B].Texture.Alpha := 1; end { only draw 3 visible covers in the background (the 3 that are on the opposite of the front covers} - else if (Abs(Pos) > floor(VS/2) - 1.5) then + else if (VS > 7) and (Abs(Pos) > floor(VS/2) - 1.5) then begin // Transform Pos to range [-1..-3/4, +3/4..+1] { the 3 covers at the back will show up in the gap between the @@ -1377,6 +1377,8 @@ begin Button[B].Y := Theme.Song.Cover.Y - (Button[B].H - Theme.Song.Cover.H)*0.75; 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].Texture.Alpha := 1; + //Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; end @@ -1705,7 +1707,7 @@ var begin VS := CatSongs.VisibleSongs; - if VS > 1 then + if VS > 0 then begin if (not isScrolling) and (VS > 0) then begin -- cgit v1.2.3 From 69cd34b1a50914fad7e5befaa848a6a2c537b4ac Mon Sep 17 00:00:00 2001 From: tobigun Date: Sat, 8 May 2010 22:46:29 +0000 Subject: validate microphone settings when leaving the record options and when USDX is started: - check if a user is assigned to multiple devices. If this is the case either do not leave the record options (if we already are there) or enter the record options (if USDX was started) - the check is performed by calling TAudioInputProcessor.ValidateSettings() git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2346 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsRecord.pas | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index b7a40676..0f9cd49a 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -168,17 +168,23 @@ begin SDLK_BACKSPACE: begin // TODO: Show Save/Abort screen - Ini.Save; - AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenOptions); + if (AudioInputProcessor.ValidateSettings()) then + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; end; SDLK_RETURN: begin if (SelInteraction = ExitButtonIID) then begin - Ini.Save; - AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenOptions); + if (AudioInputProcessor.ValidateSettings()) then + begin + Ini.Save; + AudioPlayback.PlaySound(SoundLib.Back); + FadeTo(@ScreenOptions); + end; end; end; SDLK_DOWN: @@ -434,7 +440,7 @@ begin SetLength(ChannelPeak, MaxChannelCount); - StartPreview(); + UpdateInputDevice(); end; procedure TScreenOptionsRecord.OnHide; -- cgit v1.2.3 From 354ffda49ecb2d76ab5f3100d095b0dbed13f6fa Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Tue, 18 May 2010 16:27:02 +0000 Subject: forgotten changes from last commit git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2381 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 2973fbb9..8bb9365b 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -234,20 +234,11 @@ end; procedure TScreenMain.OnShow; begin inherited; - {** * Clean up TPartyGame here * at the moment there is no better place for this *} Party.Clear; - - { display cursor (on moved) } - Display.SetCursor; - - {** - * Start background music - *} - SoundLib.StartBgMusic; end; procedure TScreenMain.SetInteraction(Num: integer); -- cgit v1.2.3 From 78a47758dba94287de090a0721d2f138f7a055b8 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 19 May 2010 13:05:12 +0000 Subject: reimplemented missing single note midi playback (Shift + Space) and single note mp3 + midi playback (CTRL + Shift + Space) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2385 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 6e9cbebf..7956b127 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -492,17 +492,34 @@ begin SDLK_SPACE: begin - // Play Sentence - PlaySentenceMidi := false; // stop midi - PlaySentence := true; - Click := false; - AudioPlayback.Stop; - AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - PlayStopTime := (GetTimeFromBeat( - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); - AudioPlayback.Play; - LastClick := -100; + if (SDL_ModState = 0) or (SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL) then + begin + // Play Sentence + PlaySentenceMidi := false; // stop midi + PlaySentence := true; + Click := false; + AudioPlayback.Stop; + AudioPlayback.Position := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + PlayStopTime := (GetTimeFromBeat( + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length)); + AudioPlayback.Play; + LastClick := -100; + end; + + if (SDL_ModState = KMOD_LSHIFT) or (SDL_ModState = KMOD_LSHIFT or KMOD_LCTRL) then + begin + // Play Midi + PlaySentenceMidi := true; + + MidiTime := USTime.GetTime; + MidiStart := GetTimeFromBeat(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + MidiStop := GetTimeFromBeat( + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + + LastClick := -100; + end; end; SDLK_RETURN: -- cgit v1.2.3 From 649bc453f74b3af59c29ade469f5009a17b93995 Mon Sep 17 00:00:00 2001 From: tobigun Date: Thu, 3 Jun 2010 13:04:48 +0000 Subject: - cleanup (removed some commented unused code) - added timebar display toggling with the 'T'-key to switch between current, remaining and total time in sing-screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2437 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 120 +++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 68 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 233f1e38..67855e77 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -62,6 +62,12 @@ type function GetClock(): real; override; end; + TTimebarMode = ( + tbmCurrent, // current song position + tbmRemaining, // remaining time + tbmTotal // total time + ); + type TScreenSing = class(TMenu) private @@ -70,6 +76,7 @@ type fVideoClip: IVideo; fLyricsSync: TLyricsSyncSource; fMusicSync: TMusicSyncSource; + fTimebarMode: TTimebarMode; protected eSongLoaded: THookableEvent; //< event is called after lyrics of a song are loaded on OnShow Paused: boolean; //pause Mod @@ -178,7 +185,9 @@ begin Result := false; Exit; end; - Ord('V'): // show visualization + + // show visualization + Ord('V'): begin fShowVisualization := not fShowVisualization; @@ -193,11 +202,23 @@ begin end; Exit; end; + + // pause Ord('P'): begin Pause; Exit; end; + + // toggle time display + Ord('T'): + begin + if (fTimebarMode = High(TTimebarMode)) then + fTimebarMode := Low(TTimebarMode) + else + Inc(fTimebarMode); + Exit; + end; end; // check special keys @@ -450,6 +471,8 @@ begin Statics[StaticP3R].Visible := V3R; Text[TextP3R].Visible := V3R; + fTimebarMode := tbmCurrent; + // FIXME: sets path and filename to '' ResetSingTemp; @@ -725,8 +748,10 @@ end; function TScreenSing.Draw: boolean; var - Min: integer; - Sec: integer; + DisplayTime: real; + DisplayPrefix: string; + DisplayMin: integer; + DisplaySec: integer; T: integer; CurLyricsTime: real; VideoFrameTime: Extended; @@ -769,53 +794,31 @@ begin end; // case end; // if - //// - // dual screen, part 1 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff. Commenting this stuff out, nothing - // was missing on screen w/ 6 players - so do we even need this stuff? - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X + 10 * ScreenX; - - Text[TextP1].X := Text[TextP1].X + 10 * ScreenX; } - - {Statics[StaticP1ScoreBG].Texture.X := Statics[StaticP1ScoreBG].Texture.X + 10*ScreenX; - Text[TextP1Score].X := Text[TextP1Score].X + 10*ScreenX;} - - {Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X + 10 * ScreenX; - - Text[TextP2R].X := Text[TextP2R].X + 10 * ScreenX; } - - {Statics[StaticP2RScoreBG].Texture.X := Statics[StaticP2RScoreBG].Texture.X + 10*ScreenX; - Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} - - // end of weird stuff - { - Statics[1].Texture.X := Statics[1].Texture.X + 10 * ScreenX; } - - { for T := 0 to 1 do - Text[T].X := Text[T].X + 10 * ScreenX; } - // retrieve current lyrics time, we have to store the value to avoid // that min- and sec-values do not match CurLyricsTime := LyricsState.GetCurrentTime(); - Min := Round(CurLyricsTime) div 60; - Sec := Round(CurLyricsTime) mod 60; + + // retrieve time for timebar text + case (fTimebarMode) of + tbmRemaining: begin + DisplayTime := LyricsState.TotalTime - CurLyricsTime; + DisplayPrefix := '-'; + end; + tbmTotal: begin + DisplayTime := LyricsState.TotalTime; + DisplayPrefix := '#'; + end; + else begin + DisplayTime := CurLyricsTime; + DisplayPrefix := ''; + end; + end; + DisplayMin := Round(DisplayTime) div 60; + DisplaySec := Round(DisplayTime) mod 60; // update static menu with time ... - 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); - - // draw static menu (BG) - // Note: there is no menu and the animated background brakes the video playback - //DrawBG; + Text[TextTimeText].Text := Format('%s%.2d:%.2d', + [DisplayPrefix, DisplayMin, DisplaySec]); //the song was sung to the end? Line := Lyrics.GetUpperLine(); @@ -857,8 +860,10 @@ begin //Log.LogError('Check for music finish: ' + BoolToStr(Music.Finished) + ' ' + FloatToStr(LyricsState.CurrentTime*1000) + ' ' + IntToStr(CurrentSong.Finish)); if ShowFinish then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or - (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and (not Settings.Finish) then + if (not AudioPlayback.Finished) and + ((CurrentSong.Finish = 0) or + (LyricsState.GetCurrentTime() * 1000 <= CurrentSong.Finish)) and + (not Settings.Finish) then begin // analyze song if not paused if (not Paused) then @@ -886,27 +891,6 @@ begin // draw scores Scores.Draw; - //// - // dual screen, part 2 - //////////////////////// - - // Note: ScreenX is the offset of the current screen in dual-screen mode so we - // will move the statics and texts to the correct screen here. - // FIXME: clean up this weird stuff - - {Statics[StaticP1].Texture.X := Statics[StaticP1].Texture.X - 10 * ScreenX; - Text[TextP1].X := Text[TextP1].X - 10 * ScreenX; - - Statics[StaticP2R].Texture.X := Statics[StaticP2R].Texture.X - 10 * ScreenX; - Text[TextP2R].X := Text[TextP2R].X - 10 * ScreenX; - - // end of weird - - Statics[1].Texture.X := Statics[1].Texture.X - 10 * ScreenX; - - for T := 0 to 1 do - Text[T].X := Text[T].X - 10 * ScreenX; } - // draw pausepopup // FIXME: this is a workaround that the static is drawn over the lyrics, lines, scores and effects // maybe someone could find a better solution -- cgit v1.2.3 From a33a2cee108eae94dc979b2dc2e9e822bedf035e Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 6 Jun 2010 08:21:38 +0000 Subject: cleanup git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2446 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsRecord.pas | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index 0f9cd49a..f1cfe628 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -321,12 +321,6 @@ begin end; // add Exit-button - //ButtonTheme := Theme.OptionsRecord.ButtonExit; - // adjust button position - //if (WidgetYPos <> 0) then - // ButtonTheme.Y := WidgetYPos; - //AddButton(ButtonTheme); - // I uncommented the stuff above, because it's not skinable :X AddButton(Theme.OptionsRecord.ButtonExit); if (Length(Button[0].Text) = 0) then AddButtonText(20, 5, Theme.Options.Description[7]); @@ -783,7 +777,7 @@ begin for ChannelIndex := 0 to High(Device.CaptureChannel) do begin // load player color mapped to current input channel - if (DeviceCfg.ChannelToPlayerMap[ChannelIndex] > 0) then + if (DeviceCfg.ChannelToPlayerMap[ChannelIndex] <> CHANNEL_OFF) then begin // set mapped channel to corresponding player-color LoadColor(State.R, State.G, State.B, 'P'+ IntToStr(DeviceCfg.ChannelToPlayerMap[ChannelIndex]) + 'Dark'); -- cgit v1.2.3 From b272c672d0fb3857f760bf39d3571028919c14b0 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 6 Jun 2010 08:41:02 +0000 Subject: - Now on sing-screen entry a check is performed if mics are assigned to all players. If not an error popup is displayed (but the sing-screen does not abort). - Player 1 is not assigned to the first detected audio device anymore - Previously the auto-detected one might have been a non-mic port of the internal sound card like mono or stereo mix - If the user has singstar mics he does not have to check for other automatically assigned devices for player 1 what caused many problems in the past -> Providing no default might be better (and the user can check the input volume, too) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2449 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 67855e77..aa32dd4a 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -370,6 +370,8 @@ var Color: TRGB; VideoFile, BgFile: IPath; success: boolean; + PlayerState: TBooleanDynArray; + BadPlayer: integer; begin inherited; @@ -585,6 +587,14 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); + BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay, PlayerState); + if (BadPlayer <> 0) then + begin + ScreenPopupError.ShowPopup( + Format(Language.Translate('ERROR_PLAYER_NO_DEVICE_ASSIGNMENT'), + [BadPlayer])); + end; + // prepare and start voice-capture AudioInput.CaptureStart; -- cgit v1.2.3 From 81945c399590c1bd2c6837bdae0091f6b649b3a1 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 6 Jun 2010 10:08:25 +0000 Subject: - URecord.ValidateSettings should not display the popup itself - Array free version of CheckPlayersConfig git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2450 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsRecord.pas | 24 ++++++++++++++++++++++-- src/screens/UScreenSing.pas | 3 +-- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index f1cfe628..dc4a355f 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -88,6 +88,7 @@ type procedure StartPreview; procedure StopPreview; procedure UpdateInputDevice; + function ValidateSettings: boolean; procedure ChangeVolume(VolumeChange: single); procedure DrawVolume(x, y, Width, Height: single); procedure DrawVUMeter(const State: TDrawState; x, y, Width, Height: single); @@ -120,6 +121,7 @@ uses TextGL, UGraphic, UDraw, + ULanguage, UMain, UMenuSelectSlide, UMenuText, @@ -168,7 +170,7 @@ begin SDLK_BACKSPACE: begin // TODO: Show Save/Abort screen - if (AudioInputProcessor.ValidateSettings()) then + if (ValidateSettings()) then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); @@ -179,7 +181,7 @@ begin begin if (SelInteraction = ExitButtonIID) then begin - if (AudioInputProcessor.ValidateSettings()) then + if (ValidateSettings()) then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); @@ -213,6 +215,24 @@ begin end; end; +function TScreenOptionsRecord.ValidateSettings: boolean; +var + BadPlayer: integer; +begin + BadPlayer := AudioInputProcessor.ValidateSettings(); + if (BadPlayer <> 0) then + begin + ScreenPopupError.ShowPopup( + Format(Language.Translate('ERROR_PLAYER_DEVICE_ASSIGNMENT'), + [BadPlayer])); + Result := false; + end + else + begin + Result := true; + end; +end; + constructor TScreenOptionsRecord.Create; var DeviceIndex: integer; diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index aa32dd4a..fe8ea8e8 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -370,7 +370,6 @@ var Color: TRGB; VideoFile, BgFile: IPath; success: boolean; - PlayerState: TBooleanDynArray; BadPlayer: integer; begin inherited; @@ -587,7 +586,7 @@ begin LyricsState.TotalTime := AudioPlayback.Length; LyricsState.UpdateBeats(); - BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay, PlayerState); + BadPlayer := AudioInputProcessor.CheckPlayersConfig(PlayersPlay); if (BadPlayer <> 0) then begin ScreenPopupError.ShowPopup( -- cgit v1.2.3 From f261cd24db299daee8a0d8e470ff7d173f1a1c75 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Thu, 10 Jun 2010 18:27:53 +0000 Subject: merge of VideoPreview branch into trunk git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2475 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 5 +- src/screens/UScreenSong.pas | 123 +++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 118 insertions(+), 10 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index fe8ea8e8..3e0d8078 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -522,7 +522,7 @@ begin *} fShowVisualization := false; VideoFile := CurrentSong.Path.Append(CurrentSong.Video); - if (CurrentSong.Video.IsSet) and VideoFile.IsFile then + if (Ini.VideoEnabled = 1) and CurrentSong.Video.IsSet() and VideoFile.IsFile then begin fVideoClip := VideoPlayback.Open(VideoFile); fCurrentVideo := fVideoClip; @@ -859,7 +859,8 @@ begin fCurrentVideo.GetFrame(VideoFrameTime); end; - fCurrentVideo.DrawGL(ScreenAct); + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Draw; end; // draw static menu (FG) diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 6b83d522..764a0d47 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -62,8 +62,12 @@ type isScrolling: boolean; // true if song flow is about to move + fCurrentVideo: IVideo; + procedure StartMusicPreview(); procedure StopMusicPreview(); + procedure StartVideoPreview(); + procedure StopVideoPreview(); public TextArtist: integer; TextTitle: integer; @@ -128,6 +132,7 @@ type function Draw: boolean; override; procedure GenerateThumbnails(); procedure OnShow; override; + procedure OnShowFinish; override; procedure OnHide; override; procedure SelectNext; procedure SelectPrev; @@ -886,6 +891,8 @@ begin PreviewOpened := -1; isScrolling := false; + + fCurrentVideo := nil; end; procedure TScreenSong.GenerateThumbnails(); @@ -960,6 +967,7 @@ begin if (Ini.PreviewVolume <> 0) then begin StartMusicPreview; + StartVideoPreview; end; // fade in detailed cover @@ -973,6 +981,7 @@ begin UnLoadDetailedCover; StopMusicPreview(); + StopVideoPreview(); PreviewOpened := -1; end; @@ -1506,6 +1515,9 @@ begin AudioPlayback.Stop; PreviewOpened := -1; + // reset video playback engine + fCurrentVideo := nil; + if Ini.Players <= 3 then PlayersPlay := Ini.Players + 1; if Ini.Players = 4 then PlayersPlay := 6; @@ -1544,11 +1556,17 @@ begin end; end; - isScrolling := true; + isScrolling := false; SetJoker; SetStatics; end; +procedure TScreenSong.OnShowFinish; +begin + isScrolling := true; + CoverTime := 10; +end; + procedure TScreenSong.OnHide; begin // turn music volume to 100% @@ -1556,6 +1574,7 @@ begin // stop preview StopMusicPreview(); + StopVideoPreview(); end; procedure TScreenSong.DrawExtensions; @@ -1573,9 +1592,10 @@ end; function TScreenSong.Draw: boolean; var - dx: real; - dt: real; - I: integer; + dx: real; + dt: real; + I: integer; + VideoAlpha: real; begin if isScrolling then begin @@ -1611,7 +1631,7 @@ begin //Log.LogBenchmark('SetScroll4', 5); //Fading Functions, Only if Covertime is under 5 Seconds - if (CoverTime < 5) then + if (CoverTime < 9) then begin // cover fade if (CoverTime < 1) and (CoverTime + TimeSkip >= 1) then @@ -1641,10 +1661,43 @@ begin //Draw BG DrawBG; + VideoAlpha := Button[interaction].Texture.Alpha*(CoverTime-1); //Instead of Draw FG Procedure: //We draw Buttons for our own for I := 0 to Length(Button) - 1 do - Button[I].Draw; + begin + if (I<>Interaction) or not Assigned(fCurrentVideo) or (VideoAlpha<1) or AudioPlayback.Finished then + Button[I].Draw; + end; + + if AudioPlayback.Finished then + StopVideoPreview; + + if Assigned(fCurrentVideo) then + begin + // Just call this once + // when Screens = 2 + if (ScreenAct = 1) then + fCurrentVideo.GetFrame(CatSongs.Song[Interaction].VideoGAP + AudioPlayback.Position); + + fCurrentVideo.SetScreen(ScreenAct); + fCurrentVideo.Alpha := VideoAlpha; + + //set up window + with Button[interaction] do + begin + fCurrentVideo.SetScreenPosition(X, Y, Z); + fCurrentVideo.Width := W; + fCurrentVideo.Height := H; + fCurrentVideo.ReflectionSpacing := Reflectionspacing; + end; + fCurrentVideo.AspectCorrection := acoCrop; + + fCurrentVideo.Draw; + + if Button[interaction].Reflection then + fCurrentVideo.DrawReflection; + end; // Statics for I := 0 to Length(Statics) - 1 do @@ -1743,7 +1796,7 @@ begin if CatSongs.VisibleSongs = 0 then Exit; - + Song := CatSongs.Song[Interaction]; if not assigned(Song) then Exit; @@ -1755,7 +1808,7 @@ begin if AudioPlayback.Open(Song.Path.Append(Song.Mp3)) then begin PreviewOpened := Interaction; - + AudioPlayback.Position := AudioPlayback.Length / 4; // set preview volume if (Ini.PreviewFading = 0) then @@ -1779,12 +1832,66 @@ begin AudioPlayback.Stop; end; +procedure TScreenSong.StartVideoPreview(); +var + VideoFile: IPath; + Song: TSong; + +begin + if (Ini.VideoPreview=0) then + Exit; + + if Assigned(fCurrentVideo) then + begin + fCurrentVideo.Stop(); + fCurrentVideo := nil; + end; + + //if no audio open => exit + if (PreviewOpened = -1) then + Exit; + + if CatSongs.VisibleSongs = 0 then + Exit; + + Song := CatSongs.Song[Interaction]; + if not assigned(Song) then + Exit; + + //fix: if main cat than there is nothing to play + if Song.main then + Exit; + + VideoFile := Song.Path.Append(Song.Video); + if (Song.Video.IsSet) and VideoFile.IsFile then + begin + fCurrentVideo := VideoPlayback.Open(VideoFile); + if (fCurrentVideo <> nil) then + begin + fCurrentVideo.Position := Song.VideoGAP + AudioPlayback.Position; + fCurrentVideo.Play; + end; + end; +end; + +procedure TScreenSong.StopVideoPreview(); +begin + // Stop video preview of previous song + if Assigned(fCurrentVideo) then + begin + fCurrentVideo.Stop(); + fCurrentVideo := nil; + end; +end; + // Changes previewed song procedure TScreenSong.ChangeMusic; begin StopMusicPreview(); + StopVideoPreview(); PreviewOpened := -1; StartMusicPreview(); + StartVideoPreview(); end; procedure TScreenSong.SkipTo(Target: cardinal); -- cgit v1.2.3 From 8e8d377291ba226116fe82141f955c8d07dfbcdb Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 10 Jun 2010 20:01:52 +0000 Subject: changes to divide note - split note in the center - use "~" instead of dash as lyrics for the new note - update lyric display after split git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2479 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 7956b127..425036b0 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1072,13 +1072,21 @@ begin Note[N] := Note[N-1]; end; - // me slightly modify new note - Note[CurrentNote].Length := 1; - Inc(Note[CurrentNote+1].Start); - Dec(Note[CurrentNote+1].Length); - Note[CurrentNote+1].Text := '- '; + // Note[Cur] and Note[Cur + 1] is identical at this point + // modify first note + Note[CurrentNote].Length := Note[CurrentNote+1].Length div 2 + Note[CurrentNote+1].Length mod 2; + + // 2nd note + Note[CurrentNote+1].Start := Note[CurrentNote].Start + Note[CurrentNote].Length; + Note[CurrentNote+1].Length := Note[CurrentNote + 1].Length div 2; + + Note[CurrentNote+1].Text := '~'; Note[CurrentNote+1].Color := 1; end; + + // update lyric display + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; end; procedure TScreenEditSub.DeleteNote; -- cgit v1.2.3 From ac102e54fc6f7232c9cace99bffeb2d79f7de86b Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 11 Jun 2010 16:43:50 +0000 Subject: fix display bug after deleting last note of a line in editor Only delete sentence if there are at least 2 left git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2489 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 69 ++++++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 30 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 425036b0..7f664fc6 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -530,7 +530,7 @@ begin begin if SDL_ModState = KMOD_LCTRL then begin - // moves text to right in current sentence + // deletes current note DeleteNote; end; end; @@ -1097,9 +1097,8 @@ begin C := Lines[0].Current; //Do Not delete Last Note - if (Lines[0].High > 0) or (Lines[0].Line[C].HighNote > 0) then + if (Lines[0].Line[C].HighNote > 0) then begin - // we copy all notes from the next to the selected one for N := CurrentNote+1 to Lines[0].Line[C].HighNote do begin @@ -1107,37 +1106,47 @@ begin end; Dec(Lines[0].Line[C].HighNote); - if (Lines[0].Line[C].HighNote >= 0) then - begin - SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); - // me slightly modify new note - if CurrentNote > Lines[0].Line[C].HighNote then - Dec(CurrentNote); - - Lines[0].Line[C].Note[CurrentNote].Color := 2; - end - //Last Note of current Sentence Deleted - > Delete Sentence - else + SetLength(Lines[0].Line[C].Note, Lines[0].Line[C].HighNote + 1); + + // last note was deleted + if (CurrentNote > Lines[0].Line[C].HighNote) then begin - //Move all Sentences after the current to the Left - for N := C+1 to Lines[0].High do - Lines[0].Line[N-1] := Lines[0].Line[N]; - - //Delete Last Sentence - SetLength(Lines[0].Line, Lines[0].High); - Lines[0].High := High(Lines[0].Line); - Lines[0].Number := Length(Lines[0].Line); - - CurrentNote := 0; - if (C > 0) then - Lines[0].Current := C - 1 - else - Lines[0].Current := 0; - - Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; + // select new last note + CurrentNote := Lines[0].Line[C].HighNote; + + // correct Line ending + with Lines[0].Line[C] do + End_ := Note[HighNote].Start + Note[HighNote].Length; end; + + Lines[0].Line[C].Note[CurrentNote].Color := 2; + end + // Last Note of current Sentence Deleted - > Delete Sentence + // if there are more than two left + else if (Lines[0].High > 1) then + begin + //Move all Sentences after the current to the Left + for N := C+1 to Lines[0].High do + Lines[0].Line[N-1] := Lines[0].Line[N]; + + //Delete Last Sentence + SetLength(Lines[0].Line, Lines[0].High); + Lines[0].High := High(Lines[0].Line); + Lines[0].Number := Length(Lines[0].Line); + + CurrentNote := 0; + if (C > 0) then + Lines[0].Current := C - 1 + else + Lines[0].Current := 0; + + Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 2; end; + + // update lyric display + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; end; procedure TScreenEditSub.TransposeNote(Transpose: integer); -- cgit v1.2.3 From 059a6898f9ab5069bd0bf5424b0590d1900325b3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 11 Jun 2010 17:03:18 +0000 Subject: fix display of "InfoBar" for songs whose first note doesn't start at beat zero git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2490 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index 7f664fc6..b3300a77 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -1413,6 +1413,7 @@ end; procedure TScreenEditSub.DrawInfoBar(x, y, w, h: integer); var start, end_: integer; + SongStart, SongEnd: integer; ww: integer; pos: real; @@ -1427,9 +1428,9 @@ begin if(numLines=0) then Exit; - start := Lines[0].Line[0].Start; - end_ := Lines[0].Line[numLines-1].End_; - ww := end_ - start; + SongStart := Lines[0].Line[0].Note[0].Start; + SongEnd := Lines[0].Line[numLines-1].End_; + ww := SongEnd - SongStart; glColor4f(0, 0, 0, 1); glDisable(GL_BLEND); @@ -1462,7 +1463,7 @@ begin end_ := Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Start+ Lines[0].Line[line].Note[Lines[0].Line[line].HighNote].Length; - pos := start/ww*w; + pos := (start - SongStart)/ww*w; br := (end_-start)/ww*w; glbegin(gl_quads); @@ -1484,13 +1485,13 @@ begin begin glColor4f(0, 0, 0, 0.5); pos := 0; - br := AktBeat/ww*w; + br := (AktBeat - SongStart)/ww*w; if (br>w) then br := w; end else begin glColor4f(1, 0, 0, 1); - pos := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start/ww*w; + pos := (Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start - SongStart)/ww*w; br := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length/ww*w; if (br<1) then br := 1; -- cgit v1.2.3 From 71e640f2d6707821a90bb91e6de38a2bc37d52a8 Mon Sep 17 00:00:00 2001 From: tobigun Date: Fri, 11 Jun 2010 22:21:51 +0000 Subject: use MidiCons: use MIDI_NOTEOFF/NOTEON constants instead of cryptic hex-numbers git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2493 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index b3300a77..ea80d778 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -50,6 +50,7 @@ uses gl, {$IFDEF UseMIDIPort} MidiOut, + MidiCons, {$ENDIF} UThemes; @@ -662,7 +663,9 @@ begin if SDL_ModState = 0 then begin {$IFDEF UseMIDIPort} - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, + Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, + 127); PlaySentenceMidi := false; {$ENDIF} @@ -694,7 +697,9 @@ begin if SDL_ModState = 0 then begin {$IFDEF UseMIDIPort} - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, + Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, + 127); PlaySentenceMidi := false; {$endif} @@ -1472,13 +1477,6 @@ begin glVertex2f(x+pos+br, y+h); glVertex2f(x+pos+br, y); glEnd; - { - numNotes := Length(Lines[0].Line[line].Nuta); - - for note := 0 to numNotes - 1 do - begin - - end; } end; if(PlaySentence or PlaySentenceMidi) then @@ -1628,7 +1626,7 @@ begin end; -// Interaction := 0; + //Interaction := 0; TextEditMode := false; end; @@ -1648,7 +1646,9 @@ begin // stop the music if (MidiPos > MidiStop) then begin - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); + MidiOut.PutShort(MIDI_NOTEOFF or 1, + Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, + 127); PlaySentenceMidi := false; end; {$ENDIF} @@ -1666,8 +1666,14 @@ begin LastClick := AktBeat; {$IFDEF UseMIDIPort} if Pet > 0 then - MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[Pet-1].Tone + 60, 127); - MidiOut.PutShort($91, Lines[0].Line[Lines[0].Current].Note[Pet].Tone + 60, 127); + begin + MidiOut.PutShort(MIDI_NOTEOFF or 1, + Lines[0].Line[Lines[0].Current].Note[Pet-1].Tone + 60, + 127); + end; + MidiOut.PutShort(MIDI_NOTEON or 1, + Lines[0].Line[Lines[0].Current].Note[Pet].Tone + 60, + 127); MidiLastNote := Pet; {$ENDIF} @@ -1688,7 +1694,7 @@ begin // click if (Click) and (PlaySentence) then begin -// AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); + //AktBeat := Floor(CurrentSong.BPM[0].BPM * (Music.Position - CurrentSong.GAP / 1000) / 60); AktBeat := Floor(GetMidBeat(AudioPlayback.Position - CurrentSong.GAP / 1000)); Text[TextDebug].Text := IntToStr(AktBeat); if AktBeat <> LastClick then @@ -1715,10 +1721,10 @@ begin if not Error then begin // Note info - Text[TextNStart].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); - Text[TextNLength].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); - Text[TextNTon].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' ( ' + GetNoteName(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' )'; - Text[TextNText].Text := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; + Text[TextNStart].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); + Text[TextNLength].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); + Text[TextNTon].Text := IntToStr(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' ( ' + GetNoteName(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Tone) + ' )'; + Text[TextNText].Text := Lines[0].Line[Lines[0].Current].Note[CurrentNote].Text; end; // Text Edit Mode -- cgit v1.2.3 From fd0388550ddbe2b817a427b6ee08be9157fff287 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 13 Jun 2010 09:42:50 +0000 Subject: Fix for invalid song lengths git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2511 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSong.pas | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSong.pas b/src/screens/UScreenSong.pas index 764a0d47..6fe8d204 100644 --- a/src/screens/UScreenSong.pas +++ b/src/screens/UScreenSong.pas @@ -1791,6 +1791,7 @@ end; procedure TScreenSong.StartMusicPreview(); var Song: TSong; + PreviewPos: real; begin AudioPlayback.Close(); @@ -1809,7 +1810,12 @@ begin begin PreviewOpened := Interaction; - AudioPlayback.Position := AudioPlayback.Length / 4; + PreviewPos := AudioPlayback.Length / 4; + // fix for invalid music file lengths + if (PreviewPos > 60.0) then + PreviewPos := 60.0; + AudioPlayback.Position := PreviewPos; + // set preview volume if (Ini.PreviewFading = 0) then begin -- cgit v1.2.3 From a2e64c7366f8a726d3979eda17cf1480bfc1e685 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 14 Jun 2010 09:24:27 +0000 Subject: minor editor fix: update lyrics after toggling freestyle git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2523 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index ea80d778..afefbb5f 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -350,6 +350,10 @@ begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntNormal else Lines[0].Line[Lines[0].Current].Note[CurrentNote].NoteType := ntFreestyle; + + // update lyrics + Lyric.AddLine(Lines[0].Current); + Lyric.Selected := CurrentNote; Exit; end; -- cgit v1.2.3 From b371fade69b3373e1cadd0a0719ebed920db5a79 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 14 Jun 2010 09:54:42 +0000 Subject: minor fix: select themes button in screenoptions after reloading theme git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2525 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptionsThemes.pas | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenOptionsThemes.pas b/src/screens/UScreenOptionsThemes.pas index 94475cc7..29d8a9dc 100644 --- a/src/screens/UScreenOptionsThemes.pas +++ b/src/screens/UScreenOptionsThemes.pas @@ -92,6 +92,10 @@ begin UGraphic.LoadScreens(); AudioPlayback.PlaySound(SoundLib.Back); + + // select theme button in new created options screen + ScreenOptions.Interaction := 4; + FadeTo(@ScreenOptions); end; SDLK_RETURN: @@ -106,6 +110,10 @@ begin UGraphic.LoadScreens(); AudioPlayback.PlaySound(SoundLib.Back); + + // select theme button in new created options screen + ScreenOptions.Interaction := 4; + FadeTo(@ScreenOptions); end; end; -- cgit v1.2.3 From 588095fb82564c2abf34278e8d0767d92ccb463e Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 Jun 2010 13:58:55 +0000 Subject: pause bg music during credits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2535 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index b1333b4a..a428cb15 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -251,6 +251,9 @@ procedure TScreenCredits.OnShow; begin inherited; + // pause background music + SoundLib.PauseBgMusic; + CRDTS_Stage := InitialDelay; Credits_X := 580; deluxe_slidein := 0; @@ -265,6 +268,8 @@ end; procedure TScreenCredits.OnHide; begin AudioPlayback.Stop; + + SoundLib.StartBgMusic; end; Procedure TScreenCredits.Draw_FunkyText; -- cgit v1.2.3 From f53aa00aaef03e3c28f4e9b71184ce2668472b38 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 17 Jun 2010 14:45:09 +0000 Subject: - enter credits screen after 30 seconds w/o user interaction in main screen - leave credits screen w/ left / right mouse button, enter, return, escape and backspace git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2536 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 3 ++- src/screens/UScreenMain.pas | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index a428cb15..b87af6bd 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -187,7 +187,8 @@ begin case PressedKey of SDLK_ESCAPE, - SDLK_BACKSPACE : + SDLK_BACKSPACE, + SDLK_RETURN : begin FadeTo(@ScreenMain); AudioPlayback.PlaySound(SoundLib.Back); diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 8bb9365b..777922de 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -44,6 +44,10 @@ uses type TScreenMain = class(TMenu) + private + { ticks when the user interacted, used to start credits + after a period of time w/o user interaction } + UserInteractionTicks: cardinal; public TextDescription: integer; TextDescriptionLong: integer; @@ -51,11 +55,17 @@ type constructor Create; override; function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure OnShow; override; procedure SetInteraction(Num: integer); override; procedure SetAnimationProgress(Progress: real); override; + function Draw: boolean; override; end; +const + { start credits after 30 seconds w/o interaction } + TicksUntilCredits = 30 * 1000; + implementation uses @@ -78,6 +88,9 @@ var begin Result := true; + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; + SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -205,6 +218,15 @@ begin end; end; +function TScreenMain.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; +begin + // default mouse behaviour + Result := inherited ParseMouse(MouseButton, BtnDown, X, Y); + + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; +end; + constructor TScreenMain.Create; begin inherited Create; @@ -239,6 +261,20 @@ begin * at the moment there is no better place for this *} Party.Clear; + + { reset user interaction timer } + UserInteractionTicks := SDL_GetTicks; +end; + +function TScreenMain.Draw: boolean; +begin + Result := inherited Draw; + + { start credits after a period w/o user interaction } + if (UserInteractionTicks + TicksUntilCredits < SDL_GetTicks) then + begin + FadeTo(@ScreenCredits, SoundLib.Start); + end; end; procedure TScreenMain.SetInteraction(Num: integer); -- cgit v1.2.3 From 241ff0a55e306bfdf2be3f999e4b1644a4398cb6 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Fri, 18 Jun 2010 11:00:21 +0000 Subject: Top5: display translated difficulty names instead of english ones git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2548 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenTop5.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/screens') diff --git a/src/screens/UScreenTop5.pas b/src/screens/UScreenTop5.pas index 705d1e35..75b9f160 100644 --- a/src/screens/UScreenTop5.pas +++ b/src/screens/UScreenTop5.pas @@ -223,7 +223,7 @@ begin Text[TextDate[I]].Visible := false; end; - Text[TextLevel].Text := IDifficulty[Ini.Difficulty]; + Text[TextLevel].Text := IDifficultyTranslated[Ini.Difficulty]; end; procedure TScreenTop5.DrawScores(difficulty: integer); -- cgit v1.2.3 From db764b0ef728dbcf746076dcfbbffa7207509262 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 30 Jun 2010 09:29:54 +0000 Subject: - code restructured (e.g.: more comments, well named comments) => its very much easier to make changes now - implemented new (working) beat detection algorithm - comments added - mouse move easter egg added to intro (needs some adjustment) - "Funky Text" still needs an updated git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2566 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 2108 +++++++++++++++++++--------------------- 1 file changed, 980 insertions(+), 1128 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index b87af6bd..468b4e84 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -47,16 +47,28 @@ uses UPath, UGraphicClasses; +{ beat detection constants and types } +const + SubChannelCount = 32; + HistoryLength = 44; + SamplesPerChannel = (FFTSize div 2) div SubChannelCount; + BeatEnergyModifier = 80; // modifies detected energy + // higher values equal a more sensitive detection + +type + TEnergyHistory = array [0..HistoryLength-1] of single; + TSubchannelHistory = array [0..SubChannelCount-1] of TEnergyHistory; + type TCreditsStages=(InitialDelay, Intro, MainPart, Outro); TScreenCredits = class(TMenu) - public + private + CreditsPath: IPath; Credits_X: real; Credits_Time: cardinal; Credits_Alpha: cardinal; - CTime: cardinal; CTime_hold: cardinal; ESC_Alpha: integer; @@ -66,15 +78,7 @@ type 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; + credits_names: array of TTexture; intro_layer01: TTexture; intro_layer02: TTexture; intro_layer03: TTexture; @@ -97,14 +101,53 @@ type CRDTS_Stage: TCreditsStages; + { beat detection } + SubChannelHistory: TSubchannelHistory; + + { mouse movement easter eggs: } + MouseMoved: boolean; + MouseX, MouseY: double; + + procedure LoadNameTextures; + + { draw different stages } + procedure DrawInitialDelay; + + { Intro } + procedure DrawIntro; + procedure DrawLayeredLogo(Separation, Scale, AngleX, AngleY, AngleZ: single); + + { Main } + procedure DrawMain; + procedure DrawMainBG; + procedure DrawFunkyText; + + procedure DrawMainFG; + + procedure DrawNames; + procedure DoLogoBling; + + { Outro } + procedure DrawOutro; + + + { beat detection } + procedure DetectBeat; + protected + { beat detection stuff + protected cause we need this information for "on beat + effect"} + LastBeatTime: cardinal; + BeatDetected: boolean; + CTime: cardinal; + public Fadeout: boolean; constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function Draw: boolean; override; + function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure OnShow; override; procedure OnHide; override; - procedure DrawCredits; - procedure Draw_FunkyText; + function Draw: boolean; override; end; const @@ -114,17 +157,9 @@ const '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,..'; +{ texture names (loaded from gameshared/resources/credits} CRDTS_BG_FILE = 'credits_v5_bg.png'; CRDTS_OVL_FILE = 'credits_v5_overlay.png'; - CRDTS_blindguard_FILE = 'names_blindguard.png'; - CRDTS_blindy_FILE = 'names_blindy.png'; - CRDTS_canni_FILE = 'names_canni.png'; - CRDTS_commandio_FILE = 'names_commandio.png'; - CRDTS_lazyjoker_FILE = 'names_lazyjoker.png'; - CRDTS_mog_FILE = 'names_mog.png'; - CRDTS_mota_FILE = 'names_mota.png'; - CRDTS_skillmaster_FILE = 'names_skillmaster.png'; - CRDTS_whiteshark_FILE = 'names_whiteshark.png'; INTRO_L01_FILE = 'intro-l-01.png'; INTRO_L02_FILE = 'intro-l-02.png'; INTRO_L03_FILE = 'intro-l-03.png'; @@ -138,32 +173,83 @@ const OUTRO_ESC_FILE = 'outro-esc.png'; OUTRO_EXD_FILE = 'outro-exit-dark.png'; - Timings: array[0..21] of cardinal=( - 20, // 0 Delay before Start - - 149, // 1 End first Intro Zoom - 155, // 2 Start 2. Action in Intro - 170, // 3 End Separation in Intro - 271, // 4 beginning Zoomout in Intro - 0, // 5 unused - 261, // 6 Start fade-to-white in Intro - - 271, // 7 Start Main Part - 280, // 8 Start On-Beat-Star 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 in intro +{ some timings } + Delay_Before_Start = 20; + Intro_Flare_Start = 60; + Intro_Zoom_End = 149; + Intro_Stand_End = 155; + Intro_Separation_End = 170; + Intro_FadeToWhite_Start = 261; + Intro_Zoomout_Start = 271; + Main_Start = 271; + Main_OnBeatTwinkle_Start = 280; + Main_Names_Start = 359; + Main_Names_End = 2833; + Main_FadeOut_Start = 3096; + Tune_End = 3366; + +{ cosntants for developer names } + +type + TFadeEffect = procedure (const Tex: TTexture; Progress: double); + TCRTZ_Developer = record + Name: string; // developer name for texture loading (names_"devel".png) + Twinkle: boolean; // should there be twinkles on show + FadeIn: TFadeEffect; // fade in effect + Draw: TFadeEffect; // effect during draw + FadeOut: TFadeEffect; // fade out effect + end; + +{ effects are called with blending, texture and matrix prepared } +procedure Effect_Draw (const Tex: TTexture; Progress: double); +procedure Effect_OnBeatJitter (const Tex: TTexture; Progress: double); + +procedure Effect_Rotate_Left_Top (const Tex: TTexture; Progress: double); +procedure Effect_Rotate_Right_Bot (const Tex: TTexture; Progress: double); +procedure Effect_ZoomIn_Rotate (const Tex: TTexture; Progress: double); +procedure Effect_ZoomOut_Shift (const Tex: TTexture; Progress: double); +procedure Effect_Shift_Left (const Tex: TTexture; Progress: double); +procedure Effect_Shift_Right_Top (const Tex: TTexture; Progress: double); +procedure Effect_Flip_Bot (const Tex: TTexture; Progress: double); +procedure Effect_Flip_Right_Top (const Tex: TTexture; Progress: double); +procedure Effect_Flip_Right (const Tex: TTexture; Progress: double); +procedure Effect_Flip_Right_Bot (const Tex: TTexture; Progress: double); +procedure Effect_Rotate_Right_Top (const Tex: TTexture; Progress: double); +procedure Effect_Shift_Weird (const Tex: TTexture; Progress: double); +procedure Effect_Shift_Right_Bot (const Tex: TTexture; Progress: double); +procedure Effect_Rotate_Right_Top2(const Tex: TTexture; Progress: double); +procedure Effect_Flip_Left_Bot (const Tex: TTexture; Progress: double); +procedure Effect_Flip_Right_Top2 (const Tex: TTexture; Progress: double); +procedure Effect_Twinkle_Down (const Tex: TTexture; Progress: double); + +const + Developers: array[0..10] of TCRTZ_Developer = ( + (Name: 'alexanders'; Twinkle: true; FadeIn: Effect_Rotate_Left_Top; Draw: Effect_OnBeatJitter; FadeOut: Effect_Rotate_Right_Bot), + (Name: 'blindy'; Twinkle: true; FadeIn: Effect_ZoomIn_Rotate; Draw: Effect_OnBeatJitter; FadeOut: Effect_ZoomOut_Shift), + (Name: 'brunzel'; Twinkle: true; FadeIn: Effect_Shift_Left; Draw: Effect_Draw; FadeOut: Effect_Shift_Right_Top), + (Name: 'canni'; Twinkle: true; FadeIn: Effect_Flip_Bot; Draw: Effect_Draw; FadeOut: Effect_Flip_Right_Top), + (Name: 'hennymcc'; Twinkle: true; FadeIn: Effect_Flip_Right; Draw: Effect_OnBeatJitter; FadeOut: Effect_Flip_Right_Bot), + (Name: 'jaybinks'; Twinkle: true; FadeIn: Effect_Rotate_Right_Top; Draw: Effect_OnBeatJitter; FadeOut: Effect_Shift_Weird), + (Name: 'krueger'; Twinkle: true; FadeIn: Effect_Shift_Right_Bot; Draw: Effect_OnBeatJitter; FadeOut: Effect_Rotate_Right_Top2), + (Name: 'mezzox'; Twinkle: true; FadeIn: Effect_Flip_Left_Bot; Draw: Effect_OnBeatJitter; FadeOut: Effect_Flip_Right_Top), + (Name: 'mischi'; Twinkle: true; FadeIn: Effect_Shift_Weird; Draw: Effect_OnBeatJitter; FadeOut: Effect_Flip_Bot), + (Name: 'mog'; Twinkle: false; FadeIn: Effect_Twinkle_Down; Draw: Effect_OnBeatJitter; FadeOut: Effect_ZoomIn_Rotate), + (Name: 'whiteshark'; Twinkle: true; FadeIn: Effect_Rotate_Right_Top2; Draw: Effect_OnBeatJitter; FadeOut: Effect_Shift_Left) + ); + + { name specific times } + TimePerName = (Main_Names_End - Main_Names_Start) div Length(Developers); + NameFadeTime = 12; // duration of fade in/out in 1/100 secs + NameWaitTime = 5; // delay between fade out and fade in of the next devel in 1/100 secs + NameTwinkleTime = 2; // duration of star effects in 1/100 secs + BeatJitterTime = 3; // duration of on beat jitter effect + { position at which the names show up + note: due to use of translate this is the center + of the names not the upper left corner as usual } + NameX = 223; + NameY = 329; + NameW = 326; + NameH = 258; implementation @@ -204,9 +290,30 @@ begin end; // fi end; +function TScreenCredits.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; +begin + Result := inherited ParseMouse(MouseButton, BtnDown, X, Y); + + { calculate mouse coordinates from -1 to 1 + relative to screen center } + MouseX := (X - (ScreenW / Screens) / 2) / ((ScreenW / Screens) / 2); + MouseY := (Y - ScreenH / 2) / (ScreenH / 2); + + MouseMoved := true; +end; + +procedure TScreenCredits.LoadNameTextures; + var I: integer; +begin + SetLength(credits_names, Length(Developers)); + + for I := 0 to High(Developers) do + begin + credits_names[I] := Texture.LoadTexture(CreditsPath.Append('names_' + Developers[I].Name + '.png'), TEXTURE_TYPE_TRANSPARENT, 0); + end; +end; + constructor TScreenCredits.Create; -var - CreditsPath: IPath; begin inherited Create; @@ -215,15 +322,7 @@ begin credits_bg_tex := Texture.LoadTexture(CreditsPath.Append(CRDTS_BG_FILE), TEXTURE_TYPE_PLAIN, 0); credits_bg_ovl := Texture.LoadTexture(CreditsPath.Append(CRDTS_OVL_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_blindguard := Texture.LoadTexture(CreditsPath.Append(CRDTS_blindguard_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_blindy := Texture.LoadTexture(CreditsPath.Append(CRDTS_blindy_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_canni := Texture.LoadTexture(CreditsPath.Append(CRDTS_canni_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_commandio := Texture.LoadTexture(CreditsPath.Append(CRDTS_commandio_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_lazyjoker := Texture.LoadTexture(CreditsPath.Append(CRDTS_lazyjoker_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_mog := Texture.LoadTexture(CreditsPath.Append(CRDTS_mog_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_mota := Texture.LoadTexture(CreditsPath.Append(CRDTS_mota_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_skillmaster := Texture.LoadTexture(CreditsPath.Append(CRDTS_skillmaster_FILE), TEXTURE_TYPE_TRANSPARENT, 0); - credits_whiteshark := Texture.LoadTexture(CreditsPath.Append(CRDTS_whiteshark_FILE), TEXTURE_TYPE_TRANSPARENT, 0); + LoadNameTextures; intro_layer01 := Texture.LoadTexture(CreditsPath.Append(INTRO_L01_FILE), TEXTURE_TYPE_TRANSPARENT, 0); intro_layer02 := Texture.LoadTexture(CreditsPath.Append(INTRO_L02_FILE), TEXTURE_TYPE_TRANSPARENT, 0); @@ -242,38 +341,341 @@ begin CRDTS_Stage:=InitialDelay; end; -function TScreenCredits.Draw: boolean; -begin - DrawCredits; - Draw := true; -end; - procedure TScreenCredits.OnShow; begin inherited; - // pause background music + { pause background music } SoundLib.PauseBgMusic; CRDTS_Stage := InitialDelay; + CTime := 0; Credits_X := 580; - deluxe_slidein := 0; - Credits_Alpha := 0; -// Music.SetLoop(true); loop loops not, shit + + { open credits tune, we play it after initial delay } AudioPlayback.Open(soundpath.Append('wome-credits-tune.mp3')); // thank you wetue -// Music.Play; - CTime := 0; -// setlength(CTime_hold,0); + + { reset twinkling stars } + GoldenRec.KillAll; + + { reset mouse coords } + MouseMoved := false; + MouseX := 0; + MouseY := 0; + + { hide cursor } + Display.SetCursor; end; procedure TScreenCredits.OnHide; begin AudioPlayback.Stop; + { show cursor } + Display.SetCursor; + SoundLib.StartBgMusic; end; -Procedure TScreenCredits.Draw_FunkyText; +function TScreenCredits.Draw: boolean; + var + T: cardinal; +begin + Result := true; + + // reset beat detection + BeatDetected := false; + + T := SDL_GetTicks() 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 >= Delay_Before_Start) then + begin + CRDTS_Stage := Intro; + CTime := 0; + AudioPlayback.Play; + end + else if (CRDTS_Stage = Intro) and (CTime >= Main_Start) then + begin + CRDTS_Stage := MainPart; + end + else if (CRDTS_Stage = MainPart) and (CTime >= Tune_End) then + begin + CRDTS_Stage := Outro; + end; + + // dis does teh muiwk y0r to be translated :-) + DetectBeat; + end; + + case CRDTS_Stage of + InitialDelay: DrawInitialDelay; + Intro: DrawIntro; + MainPart: DrawMain; + Outro: DrawOutro; + end; + + // make the stars shine + GoldenRec.Draw; +end; + +procedure TScreenCredits.DrawInitialDelay; +begin + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); +end; + +procedure TScreenCredits.DrawIntro; + var + Separation, Scale, + AngleX, AngleY, AngleZ: single; + FlareX, FlareY: single; + I: integer; +begin + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + + { rotate logo anti clockwise and make it grow } + if (CTime >= Intro_Separation_End) then + begin + Separation := 1; + Scale := 1 + sqr(CTime - Intro_Separation_End) / (32 * (Main_Start - Intro_Separation_End)); + AngleX := 0; + AngleY := 0; + AngleZ := 20 * sqr(CTime - Intro_Separation_End) / sqr((Main_Start - Intro_Separation_End) / 2); + end + + { separate layers } + else if (CTime >= Intro_Stand_End) then + begin + Separation := 0.5 + 0.5 * (CTime - Intro_Stand_End) / (Intro_Separation_End - Intro_Stand_End); + Scale := 1; + AngleX := 0; + AngleY := 0; + AngleZ := 0; + end + + { stand still } + else if (CTime >= Intro_Zoom_End) then + begin + Separation := 0.5; + Scale := 1; + AngleX := 0; + AngleY := 0; + AngleZ := 0; + end + + { rotate left } + else + begin + Separation := 0.5 + 0.5 * (Intro_Zoom_End - CTime) / (Intro_Zoom_End); + Scale := 1; + AngleX := 10 * (Intro_Zoom_End - CTime) / (Intro_Zoom_End); + AngleY := 20 * (Intro_Zoom_End - CTime) / (Intro_Zoom_End); + AngleZ := 0; + end; + + { the user moved the mouse, overwrite X and Y angle with + according to mouse position } + if (MouseMoved) then + begin + AngleX := 30 * MouseY; + AngleY := 30 * MouseX; + end; + + DrawLayeredLogo(Separation, Scale, AngleX, AngleY, AngleZ); + + { do some sparkling effects } + if (CTime < Intro_Zoom_End) and (CTime > Intro_Flare_Start) then + begin + for I := 1 to 3 do + begin + FlareX := 410 + Floor((CTime - Intro_Flare_Start) / (Intro_Zoom_End - Intro_Flare_Start) * (536 - 410)) + RandomRange(-5, 5); + FlareY := Floor((Intro_Zoom_End - CTime) / 22) + RandomRange(285, 301); + GoldenRec.Spawn(FlareX, FlareY, 1, 16, 0, -1, Flare, 0); + end; + end; + + { fade to white at end } + if Ctime > Intro_FadeToWhite_Start then + begin + glColor4f(1, 1, 1, sqr(CTime - Intro_FadeToWhite_Start) * (CTime - Intro_FadeToWhite_Start) / sqr(Main_Start - Intro_FadeToWhite_Start)); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f( 0, 0); + glVertex2f( 0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); + glEnd; + glDisable(GL_BLEND); + 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.DrawLayeredLogo(Separation, Scale, AngleX, AngleY, AngleZ: single); + var + TotalAngle: single; +begin + Start3D; + glPushMatrix; + + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); + + glTranslatef(0, 0, -5 + 0.5 * Separation); + + TotalAngle := Abs(AngleX) + Abs(AngleY) + Abs(AngleZ); + if not isZero(TotalAngle) then + glRotatef(TotalAngle, AngleX / TotalAngle, AngleY / TotalAngle, AngleZ / TotalAngle); + + glScalef(Scale, Scale, 1); + + 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 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.4 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.4 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.4 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.3 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.3 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.3 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.3 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.2 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.2 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.2 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.2 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.1 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.1 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.1 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.1 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.1 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.1 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.1 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.1 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.2 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.2 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.2 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.2 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.3 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.3 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.3 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.3 * Separation); + glEnd; + + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.22 * Separation); + glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.22 * Separation); + glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.22 * Separation); + glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.22 * Separation); + glEnd; + + glDisable(Gl_Texture_2D); + glDisable(GL_BLEND); + + glPopMatrix; + End3D; +end; + +procedure TScreenCredits.DrawMain; +begin + DrawMainBG; + DrawFunkyText; + DrawNames; + DrawMainFG; + DoLogoBling; + + // fade out at end of main part + if (Ctime > Main_FadeOut_Start) then + begin + glColor4f(0, 0, 0, (CTime - Main_FadeOut_Start) / (Tune_End - Main_FadeOut_Start)); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f( 0, 0); + glVertex2f( 0, 600); + glVertex2f(800, 600); + glVertex2f(800, 0); + glEnd; + glDisable(GL_BLEND); + end; +end; + +procedure TScreenCredits.DrawMainBG; +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, RenderH); + glTexCoord2f(800/1024, 600/1024); glVertex2f(RenderW, RenderH); + glTexCoord2f(800/1024, 0); glVertex2f(RenderW, 0); + glEnd; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); +end; + +procedure TScreenCredits.DrawFunkyText; var S: integer; X, Y, A: real; @@ -282,7 +684,7 @@ begin SetFontSize(30); // init ScrollingText - if (CTime = Timings[7]) then + if (CTime = Main_Start) then begin // set position of text Credits_X := 600; @@ -290,7 +692,7 @@ begin CurrentScrollEnd := 1; end; - if (CTime > Timings[7]) and + if (CTime > Main_Start) and (CurrentScrollStart < length(Funky_Text)) then begin X := 0; @@ -347,1126 +749,576 @@ begin } end; -procedure Start3D; +procedure TScreenCredits.DrawNames; + var + Dev: integer; + Ticks: integer; + DevTicks: integer; + TwinkleW, TwinkleH: integer; 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: cardinal; - Data: TFFTData; - j, k, l: cardinal; - f, g: real; - STime: cardinal; - Delay: 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 to be translated :-) - AudioPlayback.GetFFTData(Data); - - Log.LogStatus('', ' JB-1'); - - T := SDL_GetTicks() div 33; - if T <> Credits_Time then + Ticks := (CTime - Main_Names_Start); + Dev := Ticks div TimePerName; + DevTicks := Ticks mod TimePerName; + + {// debug stuff + SetFontPos(20, 20); + glPrint('Ticks: ' + IntToStr(Ticks)); + SetFontPos(20, 45); + glPrint('Dev: ' + IntToStr(Dev)); + SetFontPos(20, 70); + glPrint('DevTicks: ' + IntToStr(DevTicks)); //} + + if (Ticks >= 0) and (Dev <= High(Developers)) then begin - Credits_Time := T; - inc(CTime); - inc(CTime_hold); - Credits_X := Credits_X-2; - - Log.LogStatus('', ' JB-2'); - if (CRDTS_Stage=InitialDelay) and (CTime = Timings[0]) then + { spawn twinkling stars } + if (Developers[Dev].Twinkle) and (DevTicks >= NameFadeTime) and (DevTicks <= NameFadeTime + NameTwinkleTime) then begin -// CTime := Timings[20]; -// CRDTS_Stage := Outro; - CRDTS_Stage := Intro; - CTime := 0; - AudioPlayback.Play; + TwinkleW := Round(NameW * 0.6); + TwinkleH := Round(NameH * 0.6); + + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-TwinkleW, TwinkleW), NameY + RandomRange(-TwinkleH, TwinkleH), 1, 16, 0, -1, PerfectLineTwinkle, 5); end; - if (CRDTS_Stage = Intro) and (CTime = Timings[7]) then - begin - CRDTS_Stage := MainPart; - end; - if (CRDTS_Stage = MainPart) and (CTime = Timings[20]) then - begin - CRDTS_Stage := Outro; - end; - end; - - Log.LogStatus('', ' JB-3'); - // draw background - if CRDTS_Stage = InitialDelay then - begin - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end - else - if CRDTS_Stage = Intro then - begin - Start3D; + { prepare drawing } glPushMatrix; - - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - glEnable(GL_TEXTURE_2D); + glTranslatef(NameX, NameY, 0); + glBindTexture(GL_TEXTURE_2D, credits_names[Dev].TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); - if CTime < Timings[1] then + // calculate progress and call effect + if (DevTicks <= NameFadeTime) then + Developers[Dev].FadeIn(credits_names[Dev], DevTicks / NameFadeTime) + else if (DevTicks >= TimePerName - NameFadeTime - NameWaitTime) 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 + if (DevTicks < TimePerName - NameWaitTime) then + Developers[Dev].FadeOut(credits_names[Dev], ((TimePerName - NameWaitTime) - DevTicks) / NameFadeTime); 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); + Developers[Dev].Draw(credits_names[Dev], (DevTicks - NameFadeTime) / (TimePerName - NameFadeTime * 2 - NameWaitTime)); - 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_TEXTURE_2D); glDisable(GL_BLEND); - glPopMatrix; - End3D; + end; +end; + +procedure TScreenCredits.DrawMainFG; +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_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; - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then + + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); +end; + +procedure TScreenCredits.DoLogoBling; + 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) + ); + var + Coords: integer; + StartFrame: integer; +begin + if (CTime > Main_OnBeatTwinkle_Start ) and + (CTime < Main_FadeOut_Start) then begin - for k:= 1 to 3 do + { spawn stars only in frames where a beat was detected } + if BeatDetected then 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); + StartFrame := RandomRange(6, 16); + Coords := RandomRange(0, 27); + + GoldenRec.Spawn(myLogoCoords[Coords,0], myLogoCoords[Coords,1], 16-StartFrame, StartFrame, 0, -1, PerfectNote, 0); end; 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; +procedure TScreenCredits.DrawOutro; +begin + if CTime = Tune_End then + begin + CTime_hold := 0; + AudioPlayback.Stop; + AudioPlayback.Open(SoundPath.Append('credits-outro-tune.mp3')); + AudioPlayback.SetVolume(0.2); + AudioPlayback.SetLoop(true); + AudioPlayback.Play; + end; - end; - if (CRDTS_Stage=MainPart) then - // main credits screen background, scroller, logo and girl - begin + if CTime_hold > 231 then + begin + AudioPlayback.Play; + Ctime_hold := 0; + end; - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 600/1024); glVertex2f( 0, 600); - glTexCoord2f(800/1024, 600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024, 0); glVertex2f(800, 0); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // draw scroller - Draw_FunkyText; - - //######################################################################### - // draw credits names - - Log.LogStatus('', ' JB-4'); - - // BlindGuard (rotate in from upper left, rotate out to lower right) - STime := Timings[9] - 10; - Delay := Timings[10] - Timings[9]; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; + // do something useful + // outro background + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - 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; + 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, (2 + sin(CTime / 15)) / 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; + + if (RandomRange(0,20) <= 18) then + begin + glColor4f(1, 1, 1, 1); + 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; + end; - glPushMatrix; - gltranslatef(0, 329, 0); - if CTime <= STime + 10 then - glrotatef((CTime - STime) * 9 + 270, 0, 0, 1); - 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; + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); - // Blindy (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) - STime := Timings[10] - 10; - Delay := Timings[11] - Timings[10] + 5; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; + // outro scrollers? + // ... +end; - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +{ name effects } +{ effects are called with blending texture and matrix prepared } +procedure Effect_Draw (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, 1); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime+20) and (CTime<=STime+22) then - begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; +procedure Effect_OnBeatJitter (const Tex: TTexture; Progress: double); + var + Diff: cardinal; + Alpha: double; +begin + Diff := ScreenCredits.CTime - ScreenCredits.LastBeatTime; + if (Diff < BeatJitterTime) then + Alpha := 0.5 + 0.5 * Diff / BeatJitterTime + else + Alpha := 1; + + glColor4f(1, 1, 1, Alpha); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +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; +procedure Effect_Rotate_Left_Top (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); + + gltranslatef(-NameX, 0, 0); + glrotatef(Progress * 90 + 270, 0, 0, 1); + gltranslatef(NameX, 0, 0); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - // Canni (shift in from left, shift out to upper right) - STime := Timings[11] - 10; - Delay := Timings[12] - Timings[11] + 5; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; +procedure Effect_Rotate_Right_Bot (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); + + gltranslatef(NameX, 0, 0); + glrotatef((Progress - 1) * 90, 0, 0, 1); + gltranslatef(-NameX, 0, 0); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +procedure Effect_ZoomIn_Rotate (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); - 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; + glscalef(sqr(Progress), sqr(Progress), sqr(Progress)); + glrotatef(Progress * 360, 0, 0, 1); - 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; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - // Commandio (flip in from down, flip out to upper right) - STime := Timings[12] - 10; - Delay := Timings[13] - Timings[12]; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; +procedure Effect_ZoomOut_Shift (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); + + X := (1 - Progress); + gltranslatef(X * 300, -X * 100, 0); + glscalef(1 + X, 1 + X, 1 + X); + glrotatef(X * 90, 0, 0, 1); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +procedure Effect_Shift_Left (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); - 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; + glTranslatef((Progress - 1) * 210, 0, 0); - 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; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +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; +procedure Effect_Shift_Right_Top (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; + glTranslatef((1 - Progress) * 210, (Progress - 1) * 105, 0); - 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; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - // Mog (flip in from right, flip out to lower right) - STime := Timings[14] - 10; - Delay := Timings[15] - Timings[14] + 5; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; +procedure Effect_Flip_Bot (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; + X := NameH * (1 - Progress); - 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; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2 - 1.5 * X, -NameH/2 + 1.5 * X); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2 + 1.5 * X, -NameH/2 + 1.5 * X); + glEnd; +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; +procedure Effect_Flip_Right_Top (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - // Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing) - STime := Timings[15] - 10; - Delay := Timings[16] - Timings[15] + 5; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; + X := NameW * (1 - Progress); - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2 + X, -NameH/2 - X/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2 + X, NameH/2 - (X * 1.5 * NameH / NameW)); + glTexCoord2f(1, 1); glVertex2f( NameW/2 + X, NameH/2 + X / 4); + glTexCoord2f(1, 0); glVertex2f( NameW/2 + X, -NameH/2 - X / 4); + glEnd; +end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); - GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); - end; +procedure Effect_Flip_Right (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - 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; + X := NameW * (1 - Progress); - // Skillmaster (shift in from lower right, rotate out to upper right) - STime := Timings[16] - 10; - Delay := Timings[17] - Timings[16] + 5; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2 - X, NameH/2 + X * 1.5); + glTexCoord2f(1, 0); glVertex2f( NameW/2 - X, -NameH/2 - X * 1.5); + glEnd; +end; - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +procedure Effect_Flip_Right_Bot (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - 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; + X := NameW * (1 - Progress); - 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; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2 + X * 1.5, -NameH/2 + X * 1.5); + glTexCoord2f(0, 1); glVertex2f(-NameW/2 + X * 1.2, NameH/2 + X); + glTexCoord2f(1, 1); glVertex2f( NameW/2 + X / 2, NameH/2 + X / 4); + glTexCoord2f(1, 0); glVertex2f( NameW/2 + X * 1.5, -NameH/2); + glEnd; +end; - // WhiteShark (flip in from lower left, flip out to upper right) - STime := Timings[17] - 10; - Delay := Timings[18] - Timings[17]; - if CTime > STime then - begin - k := 0; - ESC_Alpha := 20; +procedure Effect_Rotate_Right_Top (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); + + glTranslatef(NameX, 0, 0); + glrotatef((1 - Progress) * 90, 0, 0, 1); + glTranslatef(-NameX, 0, 0); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +procedure Effect_Shift_Weird (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - 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; + X := (Progress - 1); - glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - f := 326.0 - 32.6 * (CTime - STime) - else - f := 0; + glTranslatef(X * 200, X * 100, 0); + glScalef(Progress, Progress, Progress); + glRotatef(X * 90, 0, 0, 1); - if (CTime >= STime + Delay - 10) and (CTime <= STime + Delay) then - begin - j := CTime - (STime + Delay - 10); - g := 32.6 * j; - end - else - begin - g := 0; - end; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - 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; +procedure Effect_Shift_Right_Bot (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); - Log.LogStatus('', ' JB-103'); + glTranslatef((1 - Progress) * 200, (1 - Progress) * 100, 0); - // #################################################################### - // do some twinkle stuff (kinda on beat) + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - if (CTime > Timings[8] ) and - (CTime < Timings[19]) then - begin - k := 0; - - try - for j := 0 to 40 do - begin - if (j < length(Data)) and - (k < length(Data)) then - begin - if Data[j] >= Data[k] then - k := j; - end; - end; - except - end; +procedure Effect_Rotate_Right_Top2 (const Tex: TTexture; Progress: double); +begin + glColor4f(1, 1, 1, Progress); + + glTranslatef(0, -NameX, 0); + glRotatef((Progress - 1) * 90, 0, 0, 1); + glTranslatef(0, NameX, 0); + glRotatef((1 - Progress) * 90, 0, 0, 1); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH/2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2, NameH/2); + glTexCoord2f(1, 1); glVertex2f( NameW/2, NameH/2); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH/2); + glEnd; +end; - if Data[k] > 0.2 then - begin - l := RandomRange(6, 16); - j := RandomRange(0, 27); - - GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); - end; - end; +procedure Effect_Flip_Left_Bot (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); - //################################################# - // 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; + X := (1 - Progress) * NameW; -{ - 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); + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2 - X, -NameH/2 + X / 4); + glTexCoord2f(0, 1); glVertex2f(-NameW/2 - X / 4, NameH/2 + X / 4); + glTexCoord2f(1, 1); glVertex2f( NameW/2 - X * 1.2, NameH/2 + X / 2); + glTexCoord2f(1, 0); glVertex2f( NameW/2 - X * 1.5, -NameH/2 + X * 1.5); + glEnd; +end; - // fade out at end of main part - if Ctime > Timings[19] then - begin - glColor4f(0, 0, 0, (CTime - Timings[19]) / (Timings[20] - Timings[19])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f( 0, 0); - glVertex2f( 0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); - glEnd; - glDisable(GL_BLEND); - end; - end - else - if (CRDTS_Stage = Outro) then - begin - if CTime = Timings[20] then - begin - CTime_hold := 0; - AudioPlayback.Stop; - AudioPlayback.Open(SoundPath.Append('credits-outro-tune.mp3')); - AudioPlayback.SetVolume(0.2); - AudioPlayback.SetLoop(true); - AudioPlayback.Play; - end; - if CTime_hold > 231 then - begin - AudioPlayback.Play; - Ctime_hold := 0; - end; - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - - // do something useful - // outro background - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); - - glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 600/1024); glVertex2f( 0, 600); - glTexCoord2f(800/1024, 600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024, 0); glVertex2f(800, 0); - glEnd; - - // outro overlays - glColor4f(1, 1, 1, (1 + sin(CTime / 15)) / 3 + 1/3); - glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 223/256); glVertex2f( 0, 223); - glTexCoord2f(487/512, 223/256); glVertex2f(487, 223); - glTexCoord2f(487/512, 0); glVertex2f(487, 0); - glEnd; - - ESC_Alpha := 20; - if (RandomRange(0,20) > 18) and (ESC_Alpha = 20) then - ESC_Alpha := 0 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - glColor4f(1, 1, 1, ESC_Alpha / 20); - glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); - glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f(800-310, 600-247); - glTexCoord2f( 0, 247/256); glVertex2f(800-310, 600 ); - glTexCoord2f(310/512, 247/256); glVertex2f(800, 600 ); - glTexCoord2f(310/512, 0); glVertex2f(800, 600-247); - glEnd; - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); - - // outro scrollers? - // ... - end; +procedure Effect_Flip_Right_Top2 (const Tex: TTexture; Progress: double); + var + X: double; +begin + glColor4f(1, 1, 1, Progress); -{ - // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(false); - SetFontSize(27); - 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 (RuntimeStr[1]); -} + X := (1 - Progress) * NameW; - // make the stars shine - GoldenRec.Draw; + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2 + X, -NameH/2 - X / 2); + glTexCoord2f(0, 1); glVertex2f(-NameW/2 + X, NameH/2 + X / 2); + glTexCoord2f(1, 1); glVertex2f( NameW/2 + X / 4, NameH/2 - X / 4); + glTexCoord2f(1, 0); glVertex2f( NameW/2 + X / 4, -NameH/2 + X / 4); + glEnd; +end; + +procedure Effect_Twinkle_Down (const Tex: TTexture; Progress: double); +begin + // draw name + glColor4f(1, 1, 1, 1); + + glTranslatef(0, NameH/2, 0); + + glBegin(gl_Quads); + glTexCoord2f(0, 0); glVertex2f(-NameW/2, -NameH * Progress); + glTexCoord2f(0, Progress); glVertex2f(-NameW/2, 0); + glTexCoord2f(1, Progress); glVertex2f( NameW/2, 0); + glTexCoord2f(1, 0); glVertex2f( NameW/2, -NameH * Progress); + glEnd; + + //spawn some stars on the edge + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 5); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 0); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 1); + GoldenRec.Spawn(NameX + RandomRange(-NameW div 2, NameW div 2), NameY - NameH/2 + (1 - Progress) * NameH, 1, 16, 0, -1, PerfectLineTwinkle, 5); +end; + +{ beat detection algorithm + based on a tutorial from Frédéric Patin on gamedev.net + http://www.gamedev.net/reference/programming/features/beatdetection/default.asp } + +{ calculates average value of a history buffer } +function Average(History: TEnergyHistory): single; + var I: integer; +begin + Result := 0; + + for I := 0 to HistoryLength - 1 do + Result := Result + History[I]; + + Result := Result / HistoryLength; +end; + +{ calculates variance value of a history buffer } +function Variance(History: TEnergyHistory; Average: single): single; + var I: integer; +begin + Result := 0; + + for I := 0 to HistoryLength - 1 do + Result := Result + sqr(History[I] - Average); + + Result := Result / HistoryLength; +end; + +{ shifts all values of the history to the right and + adds the new value at the front } +procedure AddHistory(Value: single; var History: TEnergyHistory); + var I: integer; +begin + for I := HistoryLength - 1 downto 1 do + History[I] := History[I-1]; + + History[0] := Value; +end; + +{ calculates instant energy from FFT data for a specific + subchannel (0..SubChannelCount - 1) } +function CalculateInstantEnergy(SubChannel: integer; Data: TFFTData): single; + var I: integer; +begin + Result := 0; + for I := SubChannel * SamplesPerChannel to (SubChannel + 1) * SamplesPerChannel - 1 do + Result := Result + Data[I] * BeatEnergyModifier; + + Result := Result / SamplesPerChannel; +end; + +procedure TScreenCredits.DetectBeat; + var + Data: TFFTData; + I: integer; + Instant: single; + C, E, V: single; +begin + AudioPlayback.GetFFTData(Data); + + // do beatdetection for every subchannel + for I := 0 to SubChannelCount - 1 do + begin + Instant := CalculateInstantEnergy(I, Data); + E := Average(SubchannelHistory[I]); + V := Variance(SubchannelHistory[I], E); + + C := (-0.0025714 * V) + 1.5142857; + + AddHistory(Instant, SubChannelHistory[I]); + + if (Instant > 2) and (Instant > C * E) then + begin + // beat detected + BeatDetected := true; + LastBeatTime := CTime; + end; + end; end; end. -- cgit v1.2.3 From 4be1f771a6fbe7dfdfb77582e9a7a2e7f4a0b2a3 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Wed, 30 Jun 2010 14:34:21 +0000 Subject: remove some unused elements of ScreenCredits git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2567 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index 468b4e84..e396e3be 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -68,16 +68,11 @@ type Credits_X: real; Credits_Time: cardinal; - Credits_Alpha: cardinal; CTime_hold: cardinal; - ESC_Alpha: integer; - credits_entry: TTexture; - credits_entry_dx: TTexture; credits_bg_tex: TTexture; credits_bg_ovl: TTexture; //credits_bg_logo: TTexture; - credits_bg_scrollbox_left: TTexture; credits_names: array of TTexture; intro_layer01: TTexture; intro_layer02: TTexture; @@ -92,11 +87,6 @@ type outro_esc: TTexture; outro_exd: TTexture; - deluxe_slidein: cardinal; - - CurrentScrollText: string; - NextScrollUpdate: real; - EndofLastScrollingPart: cardinal; CurrentScrollStart, CurrentScrollEnd: integer; CRDTS_Stage: TCreditsStages; -- cgit v1.2.3 From 6731fad709d6ae924c15b0781d8debadaaf4840c Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Sun, 4 Jul 2010 15:16:46 +0000 Subject: - divide ScreenW by 2 in modi list if screens=2 and fullscreen (UIni) - fixed crash after singing (with screens=2) git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2572 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index 3e0d8078..b0318072 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -230,8 +230,8 @@ begin //Sound[0].BufferLong Finish; + FadeOut := true; AudioPlayback.PlaySound(SoundLib.Back); - FadeTo(@ScreenScore); end; SDLK_SPACE: @@ -884,7 +884,7 @@ begin end else begin - if (not FadeOut) then + if (not FadeOut) and (Screens=1) or (ScreenAct=2) then begin Finish; FadeOut := true; @@ -942,7 +942,8 @@ begin SetFontItalic(false); - Party.CallAfterSing; + if not FadeOut then + Party.CallAfterSing; end; procedure TScreenSing.OnSentenceEnd(SentenceIndex: cardinal); -- cgit v1.2.3 From 3fdda014a70495b13bdda669af8d4880c999bb47 Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Thu, 8 Jul 2010 13:57:07 +0000 Subject: more consistent use of modifier key for moving notes and enables on macs, where CTRL does not work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2575 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index afefbb5f..ee811a6a 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -687,7 +687,7 @@ begin end; // decrease tone - if SDL_ModState = KMOD_LCTRL then + if SDL_ModState = KMOD_LSHIFT then begin TransposeNote(-1); end; @@ -721,7 +721,7 @@ begin end; // increase tone - if SDL_ModState = KMOD_LCTRL then + if SDL_ModState = KMOD_LSHIFT then begin TransposeNote(1); end; -- cgit v1.2.3 From 1fac8d24a0b62ec7ee4ac128758015edd929033e Mon Sep 17 00:00:00 2001 From: k-m_schindler Date: Sun, 11 Jul 2010 22:44:50 +0000 Subject: enable editor keys for macosx changing start and end of notes. CTRL does not work. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2577 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenEditSub.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenEditSub.pas b/src/screens/UScreenEditSub.pas index ee811a6a..fb3f04ce 100644 --- a/src/screens/UScreenEditSub.pas +++ b/src/screens/UScreenEditSub.pas @@ -560,7 +560,7 @@ begin end; // ctrl + right - if SDL_ModState = KMOD_LCTRL then + if (SDL_ModState = KMOD_LCTRL) or (SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT) then begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin @@ -586,7 +586,7 @@ begin end; // alt + right - if SDL_ModState = KMOD_LALT then + if (SDL_ModState = KMOD_LALT) or (SDL_ModState = KMOD_LALT + KMOD_LSHIFT) then begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then @@ -615,7 +615,7 @@ begin end; // ctrl + left - if SDL_ModState = KMOD_LCTRL then + if (SDL_ModState = KMOD_LCTRL) or (SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT) then begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); @@ -642,7 +642,7 @@ begin end; // alt + left - if SDL_ModState = KMOD_LALT then + if (SDL_ModState = KMOD_LALT) or (SDL_ModState = KMOD_LALT + KMOD_LSHIFT) then begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then begin -- cgit v1.2.3 From 3a82c1e1f853942d351e3622e6bd64768c9a9553 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Sun, 18 Jul 2010 11:11:57 +0000 Subject: some changes to mouse eEgg git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2582 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenCredits.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenCredits.pas b/src/screens/UScreenCredits.pas index e396e3be..90c0fa19 100644 --- a/src/screens/UScreenCredits.pas +++ b/src/screens/UScreenCredits.pas @@ -98,6 +98,9 @@ type MouseMoved: boolean; MouseX, MouseY: double; + { saves last x and y angle for easter egg } + LogoAngleX, LogoAngleY: single; + procedure LoadNameTextures; { draw different stages } @@ -474,10 +477,22 @@ begin according to mouse position } if (MouseMoved) then begin + // calculate destination angle AngleX := 30 * MouseY; AngleY := 30 * MouseX; + + { move angle towards destination } + if not SameValue(LogoAngleX, AngleX, 0.001) then + AngleX := LogoAngleX + 0.05 * (AngleX - LogoAngleX); + + if not SameValue(LogoAngleY, AngleY, 0.001) then + AngleY := LogoAngleY + 0.05 * (AngleY - LogoAngleY); end; + // save last angle + LogoAngleX := AngleX; + LogoAngleY := AngleY; + DrawLayeredLogo(Separation, Scale, AngleX, AngleY, AngleZ); { do some sparkling effects } -- cgit v1.2.3 From 8920d1734579bd3e66590ce6a8b4b8df6e04eb85 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Thu, 19 Aug 2010 20:47:55 +0000 Subject: reload header in screensing.OnShow git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2614 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenSing.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenSing.pas b/src/screens/UScreenSing.pas index b0318072..3b8fda40 100644 --- a/src/screens/UScreenSing.pas +++ b/src/screens/UScreenSing.pas @@ -483,9 +483,9 @@ begin try // check if file is xml if CurrentSong.FileName.GetExtension.ToUTF8 = '.xml' then - success := CurrentSong.LoadXMLSong() + success := CurrentSong.AnalyseXML and CurrentSong.LoadXMLSong() else - success := CurrentSong.LoadSong(); + success := CurrentSong.Analyse and CurrentSong.LoadSong(); except success := false; end; -- cgit v1.2.3 From 11cbdbed11fc4c98d04e968bd581e12ed695545e Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 10 Oct 2010 10:34:20 +0000 Subject: no bg-music in record screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2649 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenOptions.pas | 2 ++ src/screens/UScreenOptionsRecord.pas | 3 +++ 2 files changed, 5 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenOptions.pas b/src/screens/UScreenOptions.pas index bdb37701..30e3e9c4 100644 --- a/src/screens/UScreenOptions.pas +++ b/src/screens/UScreenOptions.pas @@ -191,6 +191,8 @@ end; procedure TScreenOptions.OnShow; begin inherited; + // continue possibly stopped bg-music (stopped in record options) + SoundLib.StartBgMusic; end; procedure TScreenOptions.InteractNext; diff --git a/src/screens/UScreenOptionsRecord.pas b/src/screens/UScreenOptionsRecord.pas index dc4a355f..7af598e5 100644 --- a/src/screens/UScreenOptionsRecord.pas +++ b/src/screens/UScreenOptionsRecord.pas @@ -445,6 +445,9 @@ var begin inherited; + // BgMusic distracts too much, pause it + SoundLib.PauseBgMusic; + Interaction := 0; // create preview sound-buffers -- cgit v1.2.3 From acbd932cf7f7ee23d39fac8230bf90b9c112f30c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 10 Oct 2010 10:39:21 +0000 Subject: start bg-music in main-screen (additionally to start in main()) - needed if a screen without music returns to main screen - bg-music start in main() was left in case the first screen is not the main-screen git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2650 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index 777922de..e6d98c27 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -256,6 +256,9 @@ end; procedure TScreenMain.OnShow; begin inherited; + + SoundLib.StartBgMusic; + {** * Clean up TPartyGame here * at the moment there is no better place for this -- cgit v1.2.3 From ee45b0c875de2c978bbf80243d9661b35610836c Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 10 Oct 2010 10:46:28 +0000 Subject: show credits after one minute instead of a half git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2651 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenMain.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/screens') diff --git a/src/screens/UScreenMain.pas b/src/screens/UScreenMain.pas index e6d98c27..aa313cf6 100644 --- a/src/screens/UScreenMain.pas +++ b/src/screens/UScreenMain.pas @@ -63,8 +63,8 @@ type end; const - { start credits after 30 seconds w/o interaction } - TicksUntilCredits = 30 * 1000; + { start credits after 60 seconds w/o interaction } + TicksUntilCredits = 60 * 1000; implementation -- cgit v1.2.3 From a7e5c4b6e24d475dd986a0d80949ed545da4a57b Mon Sep 17 00:00:00 2001 From: b_krueger Date: Sun, 10 Oct 2010 11:46:53 +0000 Subject: Bugfix: Partymode - ScoreScreen has(/starts) BG-Music now git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2654 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/screens/UScreenPartyScore.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/screens') diff --git a/src/screens/UScreenPartyScore.pas b/src/screens/UScreenPartyScore.pas index 32ca5db2..62c97161 100644 --- a/src/screens/UScreenPartyScore.pas +++ b/src/screens/UScreenPartyScore.pas @@ -316,6 +316,9 @@ begin Statics[StaticTeam3BG].Visible := false; Statics[StaticTeam3Deco].Visible := false; end; + + //start Background-Music + SoundLib.StartBgMusic; end; procedure TScreenPartyScore.SetAnimationProgress(Progress: real); -- cgit v1.2.3