From 60e6d3f9904a8114e985fccd14454b9b604ea275 Mon Sep 17 00:00:00 2001 From: brunzelchen Date: Wed, 28 Apr 2010 19:54:31 +0000 Subject: - new SDL.dll (with a quick and dirty workaround for the hanging-mouse problem) - changing of sorting and folder-option (on/off) does not need any restart now - a lot of code clean up - some bugfixes... i hope... dont't know which... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2316 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 4 +- Game/Code/Classes/UCovers.pas | 10 +- Game/Code/Classes/UDLLManager.pas | 2 +- Game/Code/Classes/UDataBase.pas | 6 +- Game/Code/Classes/UDraw.pas | 26 +- Game/Code/Classes/UFiles.pas | 6 +- Game/Code/Classes/UGraphic.pas | 111 ++++--- Game/Code/Classes/UHelp.pas | 11 +- Game/Code/Classes/UIni.pas | 13 +- Game/Code/Classes/UJoystick.pas | 4 +- Game/Code/Classes/ULog.pas | 3 - Game/Code/Classes/UMain.pas | 41 +-- Game/Code/Classes/UMusic.pas | 28 +- Game/Code/Classes/UParty.pas | 13 +- Game/Code/Classes/UPartyM2.pas | 6 +- Game/Code/Classes/URecord.pas | 5 +- Game/Code/Classes/USkins.pas | 6 +- Game/Code/Classes/USongs.pas | 413 +++++++++++++-------------- Game/Code/Classes/UTexture.pas | 9 +- Game/Code/Classes/UThemes.pas | 10 +- Game/Code/Classes/UVideo.pas | 288 ++++++++----------- Game/Code/Menu/UDisplay.pas | 3 - Game/Code/Menu/UMenu.pas | 41 ++- Game/Code/Menu/UMenuButton.pas | 23 +- Game/Code/Menu/UMenuSelect.pas | 4 +- Game/Code/Menu/UMenuSelectSlide.pas | 12 +- Game/Code/Menu/UMenuStatic.pas | 4 +- Game/Code/Menu/UMenuText.pas | 4 +- Game/Code/Screens/UScreenCredits.pas | 27 +- Game/Code/Screens/UScreenEditConvert.pas | 4 +- Game/Code/Screens/UScreenEditSub.pas | 30 +- Game/Code/Screens/UScreenLevel.pas | 12 +- Game/Code/Screens/UScreenLoading.pas | 2 +- Game/Code/Screens/UScreenMain.pas | 29 +- Game/Code/Screens/UScreenOpen.pas | 5 +- Game/Code/Screens/UScreenOptions.pas | 4 +- Game/Code/Screens/UScreenOptionsAdvanced.pas | 4 +- Game/Code/Screens/UScreenOptionsGame.pas | 20 +- Game/Code/Screens/UScreenOptionsGraphics.pas | 4 +- Game/Code/Screens/UScreenOptionsLyrics.pas | 4 +- Game/Code/Screens/UScreenOptionsRecord.pas | 2 +- Game/Code/Screens/UScreenOptionsSound.pas | 4 +- Game/Code/Screens/UScreenOptionsThemes.pas | 32 ++- Game/Code/Screens/UScreenPartyNewRound.pas | 10 +- Game/Code/Screens/UScreenPartyNewRoundM2.pas | 3 +- Game/Code/Screens/UScreenPartyOptions.pas | 4 +- Game/Code/Screens/UScreenPartyOptionsM2.pas | 2 + Game/Code/Screens/UScreenPartyPlayerM2.pas | 10 +- Game/Code/Screens/UScreenPartyScore.pas | 2 +- Game/Code/Screens/UScreenPartyWin.pas | 4 +- Game/Code/Screens/UScreenPopup.pas | 18 +- Game/Code/Screens/UScreenScore.pas | 9 +- Game/Code/Screens/UScreenSing.pas | 90 +++--- Game/Code/Screens/UScreenSingModi.pas | 6 +- Game/Code/Screens/UScreenSong.pas | 370 +++++++++++++++--------- Game/Code/Screens/UScreenSongJumpto.pas | 9 +- Game/Code/Screens/UScreenSongMenu.pas | 22 +- Game/Code/Screens/UScreenStatMain.pas | 15 +- Game/Code/Screens/UScreenTop.pas | 4 +- Game/Code/UltraStar.bdsproj | 25 +- Game/Code/UltraStar.cfg | 10 +- Game/Code/UltraStar.dpr | 57 ++-- Game/Code/lib/SQLite/SQLiteTable3.pas | 3 +- Game/Code/lib/midi/MidiFile.pas | 28 +- Game/Code/lib/midi/Midiin.pas | 7 +- Game/Code/lib/midi/Midiout.pas | 12 +- 66 files changed, 1001 insertions(+), 1008 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 7ebe1151..10043e3b 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -54,8 +54,6 @@ uses UMain, Windows, SysUtils, UGraphic; procedure BuildFont; // Build Our Bitmap Font var - font: HFONT; // Windows Font ID - h_dc: hdc; Rejestr: TResourceStream; Pet: integer; begin @@ -342,4 +340,4 @@ begin Fonts[ActFont].AspectW := Aspect; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas index b7bef8e6..c74bbaf4 100644 --- a/Game/Code/Classes/UCovers.pas +++ b/Game/Code/Classes/UCovers.pas @@ -48,7 +48,6 @@ end; procedure TCovers.Load; var F: File; - C: integer; // cover number W: word; H: word; Bits: byte; @@ -102,13 +101,14 @@ begin end; procedure TCovers.Save; +{ var F: File; C: integer; // cover number W: word; H: word; NLen: word; - Bits: byte; + Bits: byte; } begin { AssignFile(F, GamePath + 'covers.cache'); Rewrite(F, 1); @@ -133,9 +133,9 @@ end; procedure TCovers.AddCover(Name: string); var - B: integer; + //B: integer; F: File; - C: integer; // cover number + //C: integer; // cover number NLen: word; Bits: byte; begin @@ -223,4 +223,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas index 4b8838b9..6ecacfc8 100644 --- a/Game/Code/Classes/UDLLManager.pas +++ b/Game/Code/Classes/UDLLManager.pas @@ -110,7 +110,7 @@ function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean; var hLibg: THandle; Info: pModi_PluginInfo; - I: Integer; + //I: Integer; begin Result := False; //Clear Plugin Info diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas index b9b0773a..1233dae0 100644 --- a/Game/Code/Classes/UDataBase.pas +++ b/Game/Code/Classes/UDataBase.pas @@ -81,8 +81,6 @@ begin Result.P2m := 1; P1m := 0; P2m := 0; - P1c := 0; - P2c := 0; try P1c := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+ @@ -362,7 +360,7 @@ end; procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer; TimeStamp: integer); var ID: Integer; -TableData: TSqliteTable; +//TableData: TSqliteTable; begin //ScoreDB := TSqliteDatabase.Create(sFilename); try @@ -535,4 +533,4 @@ begin Result := ScoreDB.GetTableValue(Query); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas index 441b3544..5a646cc0 100644 --- a/Game/Code/Classes/UDraw.pas +++ b/Game/Code/Classes/UDraw.pas @@ -227,7 +227,6 @@ var Rec: TRecR; Pet: integer; TempR: real; - R,G,B: real; GoldenStarPos : real; begin @@ -317,10 +316,6 @@ var TempR: real; Rec: TRecR; N: integer; - R: real; - G: real; - B: real; - A: real; NotesH2: real; begin // Log.LogStatus('Player notes', 'SingDraw'); @@ -407,7 +402,7 @@ var //if (Start+Dlugosc-1 = Czas.AktBeatD) then if Perfect and (Ini.EffectSing=1) then begin // A := sqrt((1+sin(Music.Position * 3))/2); - A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); + //A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc)); if not (Start+Dlugosc-1 = Czas.AktBeatD) then //Star animation counter @@ -467,7 +462,6 @@ var Rec: TRecR; Pet: integer; TempR: real; - R,G,B: real; X1, X2, X3, X4: real; W, H: real; begin @@ -606,7 +600,7 @@ var Rec: TRecR; TexRec: TRecR; NR: TRecR; - FS: real; + //FS: real; BarFrom: integer; BarAlpha: real; BarWspol: real; @@ -618,7 +612,7 @@ var //SingBar Mod - A: Integer; + A: Cardinal; E: Integer; I: Integer; //end Singbar Mod @@ -664,7 +658,7 @@ begin ScreenSing.LyricSub.Draw; // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; + //FS := 1.3; BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; if BarFrom > 40 then BarFrom := 40; if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more @@ -998,7 +992,7 @@ var Rec: TRecR; TexRec: TRecR; NR: TRecR; - FS: real; + //FS: real; BarFrom: integer; BarAlpha: real; BarWspol: real; @@ -1010,7 +1004,7 @@ var //SingBar Mod - A: Integer; + A: Cardinal; E: Integer; I: Integer; //end Singbar Mod @@ -1059,7 +1053,7 @@ begin ScreenSingModi.LyricSub.Draw; // rysuje pasek, podpowiadajacy poczatek spiwania w scenie - FS := 1.3; + //FS := 1.3; BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start; if BarFrom > 40 then BarFrom := 40; if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more @@ -1477,6 +1471,9 @@ begin; glEnd; //SingBar coloured Bar + R := 1; + G := 0; + B := 0; Case Percent of 0..22: begin R := 1; @@ -1717,8 +1714,6 @@ const step = 5; var - txt: PChar; - str: string; I: integer; num: integer; @@ -1770,4 +1765,3 @@ begin end; end. - diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas index 854ed9b0..419a9cb8 100644 --- a/Game/Code/Classes/UFiles.pas +++ b/Game/Code/Classes/UFiles.pas @@ -461,7 +461,7 @@ end; //-------------------- function AnalyseFile(var Song: TSong): boolean; begin -Result := False; +//Result := False; {try } //Reset LineNo FileLineNo := 0; @@ -514,8 +514,6 @@ end; // Parses Note Infos and save them to Array //-------------------- procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string); -var - Space: boolean; begin case Ini.Solmization of 1: // european @@ -1210,7 +1208,7 @@ begin //set PreviewStart if not set if Song.PreviewStart=0 then begin - len_notes := length(Czesci[0].Czesc[len_lines-1].Nuta); + //len_notes := length(Czesci[0].Czesc[len_lines-1].Nuta); if Song.Medley.Source = msCalculated then Song.PreviewStart := GetTimeFromBeat(Song.Medley.StartBeat);{ else diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 0dae93a6..563873a5 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -2,7 +2,7 @@ unit UGraphic; interface uses - SDL, gl, glext, UTexture, TextGL, ULog, SysUtils, ULyrics, UScreenLoading, + SDL, gl, glext, UVideo, UTexture, ULanguage, TextGL, ULog, SysUtils, ULyrics, UScreenLoading, UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame, UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenOptionsAdvanced, UScreenSong, UScreenSing, UScreenScore, UScreenTop, UScreenEditSub, @@ -188,7 +188,7 @@ procedure LoadTextures; procedure InitializeScreen; procedure LoadScreens( aShowLoading : boolean = true ); procedure UnLoadScreens; - +procedure UpdateScreenLoading(txt: string); implementation uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows; @@ -248,11 +248,11 @@ begin end; procedure Initialize3D (Title: string); -var - Icon: TIcon; - Res: TResourceStream; - ISurface: PSDL_Surface; - Pixel: PByteArray; +//var + //Icon: TIcon; + //Res: TResourceStream; + //ISurface: PSDL_Surface; + //Pixel: PByteArray; begin Log.LogStatus('LoadOpenGL', 'Initialize3D'); Log.BenchmarkStart(2); @@ -317,7 +317,7 @@ begin LoadScreens; - if Log.NumErrors>0 then + if (Ini.LoadFaultySongs=1) and (Log.NumErrors>0) then ScreenMain.ShowNumErrors := true; Display.ActualScreen^.FadeTo(@ScreenMain); @@ -331,10 +331,10 @@ end; procedure SwapBuffers; begin SDL_GL_SwapBuffers; - glMatrixMode(GL_PROJECTION); + {glMatrixMode(GL_PROJECTION); glLoadIdentity; glOrtho(0, 800, 600, 0, -1, 100); - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_MODELVIEW);} end; procedure Reinitialize3D; @@ -346,22 +346,19 @@ end; procedure InitializeScreen; var - S: string; - I: integer; - W, H: integer; - Depth: Integer; + S: String; + I: Integer; + W, H: Integer; + Depth: Integer; + videoFlags: Integer; + videoInfo: PSDL_VideoInfo; + begin if (Params.Screens <> -1) then Screens := Params.Screens + 1 else Screens := Ini.Screens + 1; - SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); - SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - // If there is a resolution in Parameters, use it, else use the Ini value I := Params.Resolution; if (I <> -1) then @@ -373,15 +370,6 @@ begin W := StrToInt(Copy(S, 1, I-1)) * Screens; H := StrToInt(Copy(S, I+1, 1000)); - {if ParamStr(1) = '-fsblack' then begin - W := 800; - H := 600; - end; - if ParamStr(1) = '-320x240' then begin - W := 320; - H := 240; - end; } - If (Params.Depth <> -1) then Depth := Params.Depth else @@ -389,19 +377,59 @@ begin Log.LogStatus('SDL_SetVideoMode', 'Initialize3D'); -// SDL_SetRefreshrate(85); -// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); + + videoInfo := SDL_GetVideoInfo; + if ( videoInfo = nil ) then + begin + Log.LogError('Could not get video info: ' + SDL_GetError, 'Initialize3D' ); + Exit; + end; + + videoFlags := SDL_OPENGL or + SDL_DOUBLEBUF or + SDL_HWPALETTE; + + if ( videoInfo.hw_available <> 0 ) then + videoFlags := videoFlags or SDL_HWSURFACE + else + videoFlags := videoFlags or SDL_SWSURFACE; + + if ( videoInfo.blit_hw <> 0 ) then videoFlags := videoFlags or SDL_HWACCEL; + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); + SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); + + pbo_supported := false; + if (Ini.EnablePBO=1) then + begin + try + pbo_supported := glext_LoadExtension('GL_ARB_pixel_buffer_object') and + glext_LoadExtension('GL_version_1_5'); + except + pbo_supported := false; + Log.LogError('The device does not support Pixel Buffer Object (UVideo)!'); + end; + end; + if (Ini.FullScreen = 0) and (Not Params.FullScreen) then - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL) + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, videoFlags) else begin - screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN or SDL_HWSURFACE); + screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, videoFlags or SDL_FULLSCREEN); SDL_ShowCursor(0); end; + if (screen = nil) then begin Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D'); exit; end; + + // clear screen once window is being shown glClearColor(1, 1, 1, 1); glClear(GL_COLOR_BUFFER_BIT); @@ -426,7 +454,7 @@ begin Display.Draw; SwapBuffers; end; - + Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3); { ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3); Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);} @@ -436,8 +464,13 @@ begin Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3); ScreenLevel := TScreenLevel.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3); + ScreenSong := TScreenSong.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song', 3); Log.BenchmarkStart(3); + + if(aShowLoading) then + UpdateScreenLoading(Language.Translate('SING_LOADING')); + ScreenSongMenu := TScreenSongMenu.Create; Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song Menu', 3); Log.BenchmarkStart(3); ScreenSing := TScreenSing.Create; @@ -565,4 +598,12 @@ begin freeandnil( ScreenPartyPlayerM2 ); end; -end. +procedure UpdateScreenLoading(txt: string); +begin + ScreenLoading.Text[0].Text := txt; + ScreenLoading.Draw; + //Display.Draw; + SwapBuffers; +end; + +end. \ No newline at end of file diff --git a/Game/Code/Classes/UHelp.pas b/Game/Code/Classes/UHelp.pas index 4691858c..d3595e52 100644 --- a/Game/Code/Classes/UHelp.pas +++ b/Game/Code/Classes/UHelp.pas @@ -144,13 +144,14 @@ var begin SetLength(List, 0); - if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then begin + if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then + begin repeat SetLength(List, Length(List)+1); SR.Name := ChangeFileExt(SR.Name, ''); List[High(List)].Name := SR.Name; until FindNext(SR) <> 0; - SysUtils.FindClose(SR); + SysUtils.FindClose(SR); end; // if FindFirst end; @@ -310,7 +311,7 @@ end; function THelp.SetHelpID(ID: String):boolean; var - E, J: integer; // entry + E: integer; // entry begin Result := false; ScrollPos := 0.0; @@ -357,7 +358,7 @@ end; function THelp.GetHelpStr(): TTextResult; var K, I, J: Integer; - w: real; + begin SetLength(Result.Sections, Length(AEntry.Sections)); for K := 0 to Length(AEntry.Sections) - 1 do @@ -398,4 +399,4 @@ begin Result := ScrollPos; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas index 048f1496..5228d870 100644 --- a/Game/Code/Classes/UIni.pas +++ b/Game/Code/Classes/UIni.pas @@ -40,6 +40,7 @@ type MoviePreview: integer; AspectCorrect: integer; PerformanceMode:integer; + EnablePBO: integer; // Sound MicBoost: integer; @@ -153,6 +154,7 @@ const IMoviePreview: array[0..1] of string = ('Off', 'On'); IAspectCorrect: array[0..2] of String = ('Stretch', 'Crop', 'LetterBox'); IPerformanceMode:array[0..1] of string = ('Off', 'On'); + IEnablePBO: array[0..1] of string = ('Off', 'On'); IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); IClickAssist: array[0..1] of string = ('Off', 'On'); @@ -392,6 +394,11 @@ begin for Pet := 0 to High(IPerformanceMode) do if Tekst = IPerformanceMode[Pet] then Ini.PerformanceMode := Pet; + // enable Pixel Buffer Object + Tekst := IniFile.ReadString('Graphics', 'EnablePBO', IEnablePBO[0]); + for Pet := 0 to High(IEnablePBO) do + if Tekst = IEnablePBO[Pet] then Ini.EnablePBO := Pet; + // MicBoost Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off'); for Pet := 0 to High(IMicBoost) do @@ -729,6 +736,10 @@ begin Tekst := IPerformanceMode[Ini.PerformanceMode]; IniFile.WriteString('Graphics', 'PerformanceMode', Tekst); + // enable Pixel Buffer Object + Tekst := IEnablePBO[Ini.EnablePBO]; + IniFile.WriteString('Graphics', 'EnablePBO', Tekst); + // MicBoost Tekst := IMicBoost[Ini.MicBoost]; IniFile.WriteString('Sound', 'MicBoost', Tekst); @@ -867,7 +878,7 @@ end; procedure TIni.SaveLevel; var IniFile: TIniFile; - I: integer; + begin //if not FileIsReadOnly(GamePath + 'config.ini') then begin //IniFile := TIniFile.Create(GamePath + 'config.ini'); diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas index b0c7b8cc..cd9aadc5 100644 --- a/Game/Code/Classes/UJoystick.pas +++ b/Game/Code/Classes/UJoystick.pas @@ -42,7 +42,7 @@ uses SysUtils, Windows, ULog; constructor TJoy.Create; var - B, N: integer; + B{, N}: integer; begin //Old Corvus5 Method {// joystick support @@ -99,7 +99,7 @@ begin Log.LogError('Could not Init Joystick'); exit; end; - N := SDL_JoystickNumButtons(SDL_Joy); + //N := SDL_JoystickNumButtons(SDL_Joy); //if N < 6 then beep; for B := 0 to 5 do begin diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas index 8104b5b5..39c334ce 100644 --- a/Game/Code/Classes/ULog.pas +++ b/Game/Code/Classes/ULog.pas @@ -239,13 +239,11 @@ end; var - FileVoice: File; FS: TFileStream; FileName: string; Num: integer; BL: integer; Header: TWAVHeader; - ms: TMemoryStream; s: LongInt; begin @@ -309,4 +307,3 @@ end; end. - diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index cb70cd08..a20ba30c 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -2,7 +2,7 @@ unit UMain; interface uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, - gl, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup}; + gl, zlportio {you can disable it and all PortWriteB calls}, UThemes{, UScreenPopup}; type TPlayer = record @@ -112,7 +112,7 @@ function GetTimeFromBeat(Beat: integer): real; procedure ClearScores(PlayerNum: integer); implementation -uses USongs, UJoystick, math, UCommandLine; +uses USongs, UJoystick, math, UCommandLine, UVideo; procedure MainLoop; var @@ -132,12 +132,9 @@ begin done := not Display.Draw; SwapBuffers; - // light - Light.Refresh; - // delay CountMidTime; -// if 1000*TimeMid > 100 then beep; + Delay := Floor(1000 / 100 - 1000 * TimeMid); if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps @@ -154,18 +151,27 @@ begin End; Procedure CheckEvents; -//var -// p: pointer; Begin if not Assigned(Display.NextScreen) then While SDL_PollEvent( @event ) = 1 Do Begin -// beep; Case Event.type_ Of SDL_ACTIVEEVENT: //workaround for alt-tab bug begin if (Event.active.gain=1) then + begin SDL_SetModState(KMOD_NONE); + if (Ini.FullScreen = 1) or (Params.FullScreen) then + SDL_ShowCursor(0); + EnableVideoDraw := true; + end; + + if (Event.active.gain=0) then + begin + if (Ini.FullScreen = 1) or (Params.FullScreen) then + SDL_ShowCursor(1); + EnableVideoDraw := false; + end; end; SDL_QUITEV: @@ -457,8 +463,6 @@ begin else LyricSub.Clear; end; - - Sender.UpdateLCD; //On Sentence Change... Sender.onSentenceChange(Czesci[0].Akt); @@ -476,12 +480,6 @@ begin // operates on currently beated note Sender.LyricMain.Selected := Pet; -// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter); -// LCD.ShowCursor; - - LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter); - LCD.ShowCursor; - end; end; @@ -503,10 +501,6 @@ begin //LPT_1 := 0; // Light.LightOne(0, 150); - Light.LightOne(1, 200); // beat light - if ParamStr(1) = '-doublelights' then - Light.LightOne(0, 200); // beat light - { if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then Light.LightOne(0, 150) @@ -520,10 +514,6 @@ begin if Ini.ClickAssist = 1 then Music.PlayClick; - //LPT_2 := 0; - if ParamStr(1) <> '-doublelights' then - Light.LightOne(0, 150); //125 - // drum machine (* TempBeat := Czas.AktBeat;// + 2; @@ -743,4 +733,3 @@ begin end; end. - diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas index fae0ffd2..1e608c68 100644 --- a/Game/Code/Classes/UMusic.pas +++ b/Game/Code/Classes/UMusic.pas @@ -232,8 +232,8 @@ uses UGraphic, URecord, UFiles, UIni, UMain, UThemes, UTime; //from http://www.un4seen.com/forum/?topic=5943.0;hl=sbvocalcut16 procedure SBVocalCut16(handle: DWORD; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); stdcall; var - i, k: DWORD; - dmch: Smallint; + i: DWORD; + dmch: Smallint; lch, rch: PSmallint; begin @@ -305,15 +305,12 @@ begin end; procedure TMusic.InitializePlayback; -var - Pet: integer; - S: integer; begin Log.BenchmarkStart(4); Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize'); Loaded := false; Loop := false; - fHWND := AllocateHWND( nil); + fHWND := Classes.AllocateHWND( nil); if BASS_Init(1, 44100, 0, fHWND, nil) = false then begin @@ -367,14 +364,7 @@ end; procedure TMusic.InitializeRecord; var S: integer; - device: integer; - descr: string; - input: integer; - input2: integer; - flags: integer; - mic: array[0..15] of integer; - SC: integer; // soundcard - SCI: integer; // soundcard input + begin if RecordSystem = 1 then begin SetLength(Sound, 6 {max players});//Ini.Players+1); @@ -566,7 +556,7 @@ function TMusic.Length: real; var bytes: integer; begin - Result := 60; + //Result := 60; bytes := BASS_ChannelGetLength( Bass ); Result := BASS_ChannelBytes2Seconds(Bass, bytes); @@ -582,7 +572,7 @@ function TMusic.Position: real; var bytes: integer; begin - Result := 0;//MediaPlayer.Position / 1000; + //Result := 0;//MediaPlayer.Position / 1000; bytes := BASS_ChannelGetPosition(BASS); Result := BASS_ChannelBytes2Seconds(BASS, bytes); end; @@ -902,8 +892,8 @@ end; //Equalizer function TMusic.GetFFTData: TFFTData; -var -Data: TFFTData; +{var +Data: TFFTData;} begin //Get Channel Data Mono and 256 Values BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512); @@ -1013,4 +1003,4 @@ begin end; SetLength(BassVoices, 0); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas index e9d21da3..22a4847c 100644 --- a/Game/Code/Classes/UParty.pas +++ b/Game/Code/Classes/UParty.pas @@ -80,9 +80,8 @@ Type end; var - I, J, K: Integer; + I, K: Integer; plugin_order: array of TOrder; - temp: TOrder; min, len: integer; begin @@ -123,8 +122,8 @@ end; //---------- procedure TParty_Session.StartNewParty(NumRounds: Byte); var - TeamMode: Boolean; - Len: Integer; + //TeamMode: Boolean; + //Len: Integer; I, J: Integer; NumMedleys: Integer; @@ -153,13 +152,13 @@ begin PlayersPlay := Teams.NumTeams; //Get Teammode and Set Joker, also set TimesPlayed - TeamMode := True; + //TeamMode := True; For I := 0 to Teams.NumTeams-1 do begin - if Teams.Teaminfo[I].NumPlayers < 2 then + {if Teams.Teaminfo[I].NumPlayers < 2 then begin TeamMode := False; - end; + end;} //Set Player Attributes For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do begin diff --git a/Game/Code/Classes/UPartyM2.pas b/Game/Code/Classes/UPartyM2.pas index d619c798..ccf3bf7f 100644 --- a/Game/Code/Classes/UPartyM2.pas +++ b/Game/Code/Classes/UPartyM2.pas @@ -145,6 +145,7 @@ var found: boolean; begin found:=false; + Result := 0; for i := 0 to length(SongsPlayed) - 1 do begin if SongsPlayed[i].cat = cat then @@ -478,9 +479,8 @@ Type end; var - I, J, K: Integer; + I, K: Integer; plugin_order: array of TOrder; - temp: TOrder; min, len: integer; begin @@ -659,4 +659,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas index 2ec5439a..c478aebc 100644 --- a/Game/Code/Classes/URecord.pas +++ b/Game/Code/Classes/URecord.pas @@ -128,6 +128,7 @@ begin // prepare to analyze MaxW := 0; + MaxT := 0; // analyze all 12 halftones for T := 0 to 35 do begin // to 11, then 23, now 35 (for Whitney and my high voice) @@ -207,8 +208,6 @@ var L: integer; S: integer; PB: pbytearray; - PW: pwordarray; - SI: smallintarray; PSI: psmallintarray; I: integer; Skip: integer; @@ -224,6 +223,7 @@ begin 1: Boost := 2; 2: Boost := 4; 3: Boost := 8; + else Boost := 1; end; // boost buffer @@ -368,4 +368,3 @@ begin end; end. - diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas index 547f4c2c..cc70f9ae 100644 --- a/Game/Code/Classes/USkins.pas +++ b/Game/Code/Classes/USkins.pas @@ -52,8 +52,8 @@ end; procedure TSkin.LoadList; var SR: TSearchRec; - SR2: TSearchRec; - SLen: integer; + //SR2: TSearchRec; + //SLen: integer; begin if FindFirst('Skins\*', faDirectory, SR) = 0 then begin repeat @@ -67,7 +67,7 @@ end; procedure TSkin.ParseDir(Dir: string); var SR: TSearchRec; - SLen: integer; + //SLen: integer; begin if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin repeat diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas index c605703d..e3289b8a 100644 --- a/Game/Code/Classes/USongs.pas +++ b/Game/Code/Classes/USongs.pas @@ -123,7 +123,7 @@ var implementation -uses UFiles, UIni, StrUtils, Umusic; +uses UFiles, UIni, StrUtils, Umusic, UGraphic; procedure TSongs.LoadSongList; begin @@ -203,10 +203,11 @@ begin //Change Length Only every 50 Entrys Inc(BrowsePos); - + if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then begin - SetLength(Song, Length(Song) + 50); + UpdateScreenLoading('Songs: '+IntToStr(Length(Song))); + SetLength(Song, Length(Song) + 50); end; until FindNext(SR) <> 0; @@ -336,9 +337,8 @@ var CatNumber:integer; // Number of Song in Category begin CatNumShow := -1; -// Songs.Sort(0); // by title -case Ini.Sorting of + case Ini.Sorting of sEdition: begin Songs.Sort(sArtist); Songs.Sort(sEdition); @@ -357,8 +357,8 @@ case Ini.Sorting of end; sTitle: Songs.Sort(sTitle); sArtist: Songs.Sort(sArtist); - sTitle2: Songs.Sort(sTitle2); // by title2 - sArtist2: Songs.Sort(sArtist2); // by artist2 + sTitle2: Songs.Sort(sTitle2); // by title2 ??? + sArtist2: Songs.Sort(sArtist2); // by artist2 ??? end; // case @@ -369,240 +369,123 @@ case Ini.Sorting of CatNumber := 0; //Songs leeren - SetLength (Song, 0); + SetLength (CatSongs.Song, 0); - for S := Low(Songs.Song) to High(Songs.Song) do begin + for S := Low(Songs.Song) to High(Songs.Song) do + begin if (Ini.Tabs = 1) then - if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - // add Category Button - Inc(Order); - SS := Songs.Song[S].Edition; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + SS + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - - - // 0.4.3 - // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg'; - // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg'; - // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg'; - // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg'; - // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg'; - // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg'; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//} - - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then + begin + if (Ini.Sorting = sEdition) and + (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end + // add Category Button + Inc(Order); + SS := Songs.Song[S].Edition; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + SS + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; - else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - // add Genre Button - Inc(Order); - SS := Songs.Song[S].Genre; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - CatSongs.Song[CatLen].Visible := true; - end + //CatNumber Patch + if (SS <> '') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; - else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - // add Language Button - Inc(Order); - SS := Songs.Song[S].Language; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then + CatSongs.Song[CatLen].Visible := true; + end else if (Ini.Sorting = sGenre) and + (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end + // add Genre Button + Inc(Order); + SS := Songs.Song[S].Genre; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; - else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Title[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then - begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - CatSongs.Song[CatLen].Visible := true; - end + //CatNumber Patch + if (SS <> '') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; - else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin - // add a letter Category Button - Inc(Order); - Letter := UpCase(Songs.Song[S].Artist[1]); - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); - - //CatNumber Patch - if (Letter <> ' ') then + CatSongs.Song[CatLen].Visible := true; + end else if (Ini.Sorting = sLanguage) and + (CompareText(SS, Songs.Song[S].Language) <> 0) then begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; - - CatSongs.Song[CatLen].Visible := true; - end + // add Language Button + Inc(Order); + SS := Songs.Song[S].Language; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; - else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin - // 0.5.0: add folder tab - Inc(Order); - SS := Songs.Song[S].Folder; - CatLen := Length(CatSongs.Song); - SetLength(CatSongs.Song, CatLen+1); - CatSongs.Song[CatLen].Artist := SS; - CatSongs.Song[CatLen].Main := true; - CatSongs.Song[CatLen].OrderTyp := 0; - CatSongs.Song[CatLen].OrderNum := Order; - - {// cover-patch - if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} - CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - - //CatNumber Patch - if (SS <> '') then - begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); - CatSongs.Song[CatLen].Visible := true; - end + //CatNumber Patch + if (SS <> '') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; - else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin - if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]); - if (Letter <> Letter2) then begin + CatSongs.Song[CatLen].Visible := true; + end else if (Ini.Sorting = sTitle) and + (Length(Songs.Song[S].Title)>=1) and + (Letter <> UpCase(Songs.Song[S].Title[1])) then + begin // add a letter Category Button Inc(Order); - Letter := Letter2; + Letter := UpCase(Songs.Song[S].Title[1]); CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; CatSongs.Song[CatLen].Main := true; CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); CatSongs.Song[CatLen].OrderNum := Order; - {// cover-patch - if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch - if (Letter <> ' ') then - begin - if (CatLen - CatNumber - 1>=0) then - Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy - CatNumber := 0; - end; + if (Letter <> ' ') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; CatSongs.Song[CatLen].Visible := true; - end; - end - - else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin - if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]); - if (Letter <> Letter2) then begin + end else if (Ini.Sorting = sArtist) and + (Length(Songs.Song[S].Artist)>=1) and + (Letter <> UpCase(Songs.Song[S].Artist[1])) then + begin // add a letter Category Button Inc(Order); - Letter := Letter2; + Letter := UpCase(Songs.Song[S].Artist[1]); CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; CatSongs.Song[CatLen].Main := true; CatSongs.Song[CatLen].OrderTyp := 0; -// Order := ord(Letter); CatSongs.Song[CatLen].OrderNum := Order; - {// cover-patch - if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg' - else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';} CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); //CatNumber Patch @@ -612,12 +495,102 @@ case Ini.Sorting of Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy CatNumber := 0; end; - + CatSongs.Song[CatLen].Visible := true; + end else if (Ini.Sorting = sFolder) and + (CompareText(SS, Songs.Song[S].Folder) <> 0) then + begin + // 0.5.0: add folder tab + Inc(Order); + SS := Songs.Song[S].Folder; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := SS; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS); + + //CatNumber Patch + if (SS <> '') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end else if (Ini.Sorting = sTitle2) AND + (Length(Songs.Song[S].Title)>=1) then + begin + if (ord(Songs.Song[S].Title[1]) > 47) and + (ord(Songs.Song[S].Title[1]) < 58) then + Letter2 := '#' + else + Letter2 := UpCase(Songs.Song[S].Title[1]); + + if (Letter <> Letter2) then + begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + + CatSongs.Song[CatLen].OrderNum := Order; + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; + end else if (Ini.Sorting = sArtist2) AND + (Length(Songs.Song[S].Artist)>=1) then + begin + if (ord(Songs.Song[S].Artist[1]) > 47) and + (ord(Songs.Song[S].Artist[1]) < 58) then + Letter2 := '#' + else + Letter2 := UpCase(Songs.Song[S].Artist[1]); + + if (Letter <> Letter2) then + begin + // add a letter Category Button + Inc(Order); + Letter := Letter2; + CatLen := Length(CatSongs.Song); + SetLength(CatSongs.Song, CatLen+1); + CatSongs.Song[CatLen].Artist := '[' + Letter + ']'; + CatSongs.Song[CatLen].Main := true; + CatSongs.Song[CatLen].OrderTyp := 0; + CatSongs.Song[CatLen].OrderNum := Order; + + CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter); + + //CatNumber Patch + if (Letter <> ' ') then + begin + if (CatLen - CatNumber - 1>=0) then + Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy + CatNumber := 0; + end; + + CatSongs.Song[CatLen].Visible := true; + end; end; end; - CatLen := Length(CatSongs.Song); SetLength(CatSongs.Song, CatLen+1); @@ -627,17 +600,19 @@ case Ini.Sorting of CatSongs.Song[CatLen].OrderNum := Order; // assigns category CatSongs.Song[CatLen].CatNumber := CatNumber; - if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true - else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false; -// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab -//CatSongs.Song[CatLen].Visible := true; - + if (Ini.Tabs = 0) then + begin + CatSongs.Song[CatLen].Visible := true; + CatSongs.Song[CatLen].Main := false; + end else if (Ini.Tabs = 1) then + CatSongs.Song[CatLen].Visible := false; end; -//CatNumber Patch - Set CatNumber of Last Category -if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then - Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy -//CatCount Patch -CatCount := Order; + + //CatNumber Patch - Set CatNumber of Last Category + if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then + Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy + //CatCount Patch + CatCount := Order; end; procedure TCatSongs.ShowCategory(Index: integer); @@ -666,7 +641,7 @@ end; procedure TCatSongs.ClickCategoryButton(Index: integer); var - Num, S: integer; + Num: integer; begin Num := CatSongs.Song[Index].OrderNum; if Num <> CatNumShow then @@ -681,7 +656,7 @@ end; //Hide Categorys when in Category Hack procedure TCatSongs.ShowCategoryList; var - Num, S: integer; + S: integer; begin //Hide All Songs Show All Cats for S := 0 to high(CatSongs.Song) do begin @@ -791,4 +766,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index f5f47ed9..1e5bd276 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -126,7 +126,7 @@ function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTextur var T: integer; // texture C: integer; // cover - Data: array of byte; + begin // find texture entry T := FindTexture(Name); @@ -801,13 +801,8 @@ end; function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture; var - Pet: integer; - Pet2: integer; - Pix: integer; - ColInt: real; - PPix: PByteArray; - TempA: integer; Error: integer; + begin Mipmapping := false; diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas index dd90987d..f43143a6 100644 --- a/Game/Code/Classes/UThemes.pas +++ b/Game/Code/Classes/UThemes.pas @@ -991,7 +991,6 @@ end; function TTheme.LoadTheme(FileName: string; sColor: integer): boolean; var I, J: integer; - Path: string; begin create_theme_objects(); @@ -1941,8 +1940,6 @@ begin end; procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string); -var - C: integer; begin DecimalSeparator := '.'; @@ -1987,8 +1984,6 @@ begin end; procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string); -var - C: integer; begin DecimalSeparator := '.'; @@ -2043,8 +2038,7 @@ var SL: TStringList; C: integer; S: string; - Col: integer; - RGB: TRGB; + begin SL := TStringList.Create; ThemeIni.ReadSection('Colors', SL); @@ -2619,4 +2613,4 @@ begin end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas index 9e04a8ec..25c13886 100644 --- a/Game/Code/Classes/UVideo.pas +++ b/Game/Code/Classes/UVideo.pas @@ -36,10 +36,6 @@ uses SDL, {$ENDIF} UIni; -const - //PIXEL_FORMAT = GL_RGB; - numBytes = 3; - type TRectCoords = record //from 1.1 Left, Right: double; @@ -69,45 +65,61 @@ procedure ResetAspectCorrection; var - VideoOpened, VideoPaused: Boolean; - VideoTex: glUint; - //TexData: array of Byte; - VideoStreamIndex: Integer; - SkipLines: Integer; - LastSkipLines: Integer; - mmfps: Real; - Counter: Integer; - //myBuffer: pByte; - TexX, TexY, dataX, dataY: Cardinal; - VideoTimeBase, VideoTime, LastFrameTime, TimeDifference, NegativeSkipTime: Extended; - ScaledVideoWidth, ScaledVideoHeight: Real; - VideoAspect: Real; - VideoSkipTime: Single; - ActualH, ActualW: Integer; - - inst: PAc_instance; - pack: PAc_package; - info: TAc_stream_info; - videodecoder: PAc_decoder; + VideoOpened: Boolean; + VideoPaused: Boolean; + VideoTex: glUint; + + VideoStreamIndex: Integer; + SkipLines: Integer; + LastSkipLines: Integer; + mmfps: Real; + Counter: Integer; + + TexX, TexY: Integer; + dataX, dataY: Integer; + + VideoTimeBase: Extended; + VideoTime: Extended; + LastFrameTime: Extended; + TimeDifference: Extended; + NegativeSkipTime: Extended; + + ScaledVideoWidth: Real; + ScaledVideoHeight: Real; + + VideoAspect: Real; + VideoSkipTime: Single; + ActualH, ActualW: Integer; + + inst: PAc_instance; + pack: PAc_package; + info: TAc_stream_info; + videodecoder: PAc_decoder; - fAspect: real; //**< width/height ratio (from 1.1) - fAspectCorrection: TAspectCorrection; //from 1.1 + fAspect: Real; //**< width/height ratio (from 1.1) + fAspectCorrection: TAspectCorrection; //from 1.1 - fs: TFileStream; - fName: string; + fs: TFileStream; + fName: String; + + timediff_str: String; //for debug + mtime_str: String; //for debug + + pbo: glUint; + pbo_supported: Boolean; + PIXEL_FORMAT: glUint; + numBytes: Integer; + + EnableVideoDraw: boolean; - timediff: PChar; //for debug - timediff_str: string; //for debug - mtime: PChar; //for debug - mtime_str: string; //for debug - pbo: glUint; - pbo_supported: boolean; implementation uses - UGraphic, ULog, UDisplay; + UGraphic, + ULog, + UDisplay; function read_proc(sender: Pointer; buf: PByte; size: integer): integer; cdecl; begin @@ -131,30 +143,27 @@ begin fName := ''; glGenTextures(1, @VideoTex); - - //pbo_supported := glext_LoadExtension('GL_ARB_pixel_buffer_object') and - // glext_LoadExtension('GL_version_1_5'); - pbo_supported := false; + if (pbo_supported) then glGenBuffers(1, @pbo); - //SetLength(TexData,0); - fAspectCorrection := TAspectCorrection(Ini.AspectCorrect); SkipLines := 0; LastSkipLines := 0; Counter := 0; + PIXEL_FORMAT := GL_RGB; + numBytes := 3; + EnableVideoDraw := true; end; procedure acOpenFile(FileName: pAnsiChar); var I: integer; - rTimeBase: Extended; + begin VideoPaused := False; VideoTimeBase := 0; - rTimeBase := 0; VideoTime := 0; LastFrameTime := 0; TimeDifference := 0; @@ -213,9 +222,6 @@ begin TexY := videodecoder^.stream_info.additional_info.video_info.frame_height; dataX := Round(Power(2, Ceil(Log2(TexX)))); dataY := Round(Power(2, Ceil(Log2(TexY)))); - //SetLength(TexData, TexX*numBytes); - //for I := 0 to TexX*numBytes - 1 do - // TexData[I]:=0; // calculate some information for video display VideoAspect:=videodecoder^.stream_info.additional_info.video_info.pixel_aspect; @@ -238,11 +244,10 @@ begin glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0, - GL_RGB, GL_UNSIGNED_BYTE, nil); - + PIXEL_FORMAT, GL_UNSIGNED_BYTE, nil); glBindTexture(GL_TEXTURE_2D, 0); + if(pbo_supported) then begin glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo); @@ -250,9 +255,6 @@ begin glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0); end; - //SkipLines := 0; - //LastSkipLines := 0; - //Counter := 0; mmfps := 50; end; @@ -262,13 +264,14 @@ begin if videodecoder <> nil then ac_free_decoder(videodecoder); + videodecoder:=nil; ac_close(inst); ac_free(inst); inst := nil; fs.Free; fs:=nil; - //SetLength(TexData,0); + VideoOpened:=False; fName := ''; end; @@ -281,25 +284,13 @@ begin end; procedure acSkip2(Gap: Single; Start: Single); -var - seek_target: uint64; begin VideoSkiptime:=Gap; NegativeSkipTime:=Start+Gap; if Start+Gap > 0 then begin VideoTime:=Start+Gap; - //ac_seek(videodecoder, 0, Floor((Start+Gap)*1000)); ac_seek(videodecoder, -1, Floor((Start+Gap)*1000)); - //acSearch(Gap+Start); - {if (ac_seek(videodecoder, -1, Floor((Start+Gap)*1000))=0) then - if (ac_seek(videodecoder, 0, Floor((Start+Gap)*1000))=0) then - begin - ac_seek(videodecoder, 0, 0); - VideoTime:=0; - //acSearch(Gap+Start); - - end; } end else begin ac_seek(videodecoder, 0, 0); @@ -308,8 +299,6 @@ begin end; procedure acSkip(Gap: Single; Start: Single); -var - seek_target: uint64; begin VideoSkiptime:=Gap; NegativeSkipTime:=Start+Gap; @@ -336,7 +325,6 @@ var errnum: Integer; FrameDataPtr: PByteArray; myTime: Extended; - DropFrame: Boolean; begin Result := 0; @@ -346,39 +334,15 @@ begin myTime:=Time+VideoSkipTime; TimeDifference:=myTime-VideoTime; - if Ini.Debug = 1 then - begin - timediff_str:= 't-diff: ' + FormatFloat('#0.00', TimeDifference); - timediff := Addr(timediff_str[1]); - mtime_str:= 'mytime: ' + FormatFloat('#0.00', myTime); - mtime := Addr(mtime_str[1]); - end; - DropFrame:=False; if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin - if Ini.Debug = 1 then - begin - // frame delay debug display - GoldenRec.Spawn(200,65,1,16,0,-1,ColoredStar,$00ff00); - end; Exit;// we don't need a new frame now end; - if TimeDifference >= 2*VideoTimeBase then - begin // skip frames - if Ini.Debug = 1 then - begin - //frame drop debug display - GoldenRec.Spawn(200,105,1,16,0,-1,ColoredStar,$ff0000); - end; - - DropFrame:=True; - end; - pack := ac_read_package(inst); FrameFinished:=0; // read packets until we have a finished frame (or there are no more packets) - while ({(FrameFinished=0) or }(VideoTime < Time-VideoTimeBase)) and (pack <> nil) do + while ((VideoTime < Time-VideoTimeBase)) and (pack <> nil) do begin // if we got a packet from the video stream, then decode it if (videodecoder^.stream_index = pack^.stream_index) then @@ -386,13 +350,12 @@ begin FrameFinished := ac_decode_package(pack, videodecoder); VideoTime := videodecoder^.timecode; ac_free_package(pack); - if ((VideoTime < Time-VideoTimeBase) {or (FrameFinished=0)}) then + if ((VideoTime < Time-VideoTimeBase)) then pack := ac_read_package(inst); end else begin ac_free_package(pack); pack := ac_read_package(inst); - //TimeDifference:=myTime-VideoTime; end; end; if (pack<>nil) then @@ -401,7 +364,6 @@ begin // if we did not get an new frame, there's nothing more to do if Framefinished=0 then begin -// GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff); Exit; end; @@ -410,9 +372,8 @@ begin FrameDataPtr:=Pointer(videodecoder^.buffer); Result := 1; glBindTexture(GL_TEXTURE_2D, VideoTex); - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[0]); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[0]); + if Ini.Debug = 1 then begin //frame decode debug display @@ -424,18 +385,17 @@ end; procedure acGetFrame(Time: Extended); var - FrameFinished: Integer; - errnum, x, y: Integer; - FrameDataPtr: PByteArray; - FrameDataPtr2: PByteArray; - linesize: integer; - myTime: Extended; - DropFrame: Boolean; - droppedFrames: Integer; - I, J: Integer; - - glError: glEnum; - glErrorStr: String; + FrameFinished: Integer; + errnum: Integer; + FrameDataPtr: PByteArray; + FrameDataPtr2: PByteArray; + myTime: Extended; + DropFrame: Boolean; + droppedFrames: Integer; + I: Integer; + + glError: glEnum; + glErrorStr: String; const FRAMEDROPCOUNT=3; begin @@ -445,13 +405,13 @@ begin myTime:=Time+VideoSkipTime; TimeDifference:=myTime-VideoTime; + if Ini.Debug = 1 then begin timediff_str:= 't-diff: ' + FormatFloat('#0.00', TimeDifference); - timediff := Addr(timediff_str[1]); mtime_str:= 'mytime: ' + FormatFloat('#0.00', myTime); - mtime := Addr(mtime_str[1]); end; + DropFrame:=False; if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin @@ -568,13 +528,11 @@ begin begin if(I mod (SkipLines+1) = 0) then glTexSubImage2D(GL_TEXTURE_2D, 0, 0, (I div (SkipLines+1)), TexX, 1, - GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[I*numBytes*TexX]); + PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[I*numBytes*TexX]); end; end else glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, - GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[0]); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[0]); end else begin glGetError(); @@ -619,7 +577,7 @@ begin end; glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, - GL_RGB, GL_UNSIGNED_BYTE, 0); + PIXEL_FORMAT, GL_UNSIGNED_BYTE, nil); glError := glGetError; if glError <> GL_NO_ERROR then @@ -658,8 +616,6 @@ begin acoStretch : fAspectCorrection := acoLetterBox; acoLetterBox : fAspectCorrection := acoCrop; end; - //Ini.AspectCorrect := integer(fAspectCorrection); - //Ini.Save; end; procedure SetAspectCorrection(aspect: TAspectCorrection); @@ -741,7 +697,10 @@ begin TexRect.Left := 0; TexRect.Right := TexX / dataX; TexRect.Upper := 0; - TexRect.Lower := (TexY/(SkipLines+1)) / dataY; + if (not pbo_supported) then + TexRect.Lower := (TexY/(SkipLines+1)) / dataY + else + TexRect.Lower := TexY/ dataY; end; procedure acDrawGL(Screen: integer); @@ -758,22 +717,14 @@ end; procedure acDrawGLi(Screen: integer; Window: TRectCoords; Blend: real); var - text: string; - test: PChar; ScreenRect, TexRect: TRectCoords; - FrameDataPtr: PByteArray; - FrameDataPtr2: PByteArray; - Offset: Integer; begin // have a nice black background to draw on (even if there were errors opening the vid) if Not Window.windowed then begin - glDisable(GL_BLEND); - //glDisable(GL_DEPTH_TEST); - //glDepthMask(GL_FALSE); - //glDisable(GL_CULL_FACE); - + //glDisable(GL_BLEND); + glScissor(round((ScreenW/Screens)*(Screen-1)), 0, round(ScreenW/Screens), @@ -784,17 +735,18 @@ begin glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glDisable(GL_SCISSOR_TEST); - end else - glEnable(GL_BLEND); + end;{ else if EnableVideoDraw then + glEnable(GL_BLEND);} + + if not EnableVideoDraw then + Exit; // exit if there's nothing to draw - if not VideoOpened then Exit; - // if we're still inside negative skip, then exit - //if (NegativeSkipTime < 0) then Exit; + if not VideoOpened then + Exit; GetVideoRect(ScreenRect, TexRect, Window); - if Window.windowed then begin glScissor(round((Window.Left)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(Screen-1)), @@ -807,7 +759,7 @@ begin glEnable(GL_TEXTURE_2D); glColor4f(1, 1, 1, Blend); glBindTexture(GL_TEXTURE_2D, VideoTex); - + //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glbegin(gl_quads); // upper-left coord glTexCoord2f(TexRect.Left, TexRect.Upper); @@ -823,41 +775,44 @@ begin glVertex2f(ScreenRect.Right, ScreenRect.Upper); glEnd; + //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glDisable(GL_TEXTURE_2D); - //glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0); + glBindTexture(GL_TEXTURE_2D, 0); glDisable(GL_SCISSOR_TEST); - glDisable(GL_BLEND); + //glDisable(GL_BLEND); - if (Ini.MovieSize < 1) then //HalfSize BG + if (Ini.MovieSize < 1) and not Window.windowed then //HalfSize BG begin // draw fading bars over top and bottom of background/video glEnable(GL_BLEND); glBegin(GL_QUADS); (* black top *) - glColor4f(0,0,0,1); + glColor4f(0, 0, 0, 1); glVertex2f(0, 0); - glVertex2f(800,0); - glVertex2f(800,110); - glVertex2f(0,110); + glVertex2f(RenderW, 0); + glVertex2f(RenderW, 110); + glVertex2f(0, 110); + (* top gradient *) glVertex2f(0, 110); - glVertex2f(800,110); - glColor4f(0,0,0,0); - glVertex2f(800,130); - glVertex2f(0,130); + glVertex2f(RenderW, 110); + glColor4f(0, 0, 0, 0); + glVertex2f(RenderW, 130); + glVertex2f(0, 130); (* bottom gradient *) - glColor4f(0,0,0,0); - glVertex2f(0, 600-130); - glVertex2f(800,600-130); - glColor4f(0,0,0,1); - glVertex2f(800,600-110); - glVertex2f(0,600-110); + glColor4f(0, 0, 0, 0); + glVertex2f(0, RenderH-130); + glVertex2f(RenderW, RenderH-130); + glColor4f(0, 0, 0, 1); + glVertex2f(RenderW, RenderH-110); + glVertex2f(0, RenderH-110); + (* black bottom *) - glVertex2f(0, 600-110); - glVertex2f(800,600-110); - glVertex2f(800,600); - glVertex2f(0,600); + glVertex2f(0, RenderH-110); + glVertex2f(RenderW, RenderH-110); + glVertex2f(RenderW, RenderH); + glVertex2f(0, RenderH); glEnd; glDisable(GL_BLEND); @@ -892,15 +847,14 @@ begin SetFontItalic(False); SetFontSize(7); SetFontPos (5, 50); - text:= 'vtime: ' + FormatFloat('#0.00', VideoTime); - test := Addr(text[1]); - glPrint(test); + glPrint(PChar('vtime: ' + FormatFloat('#0.00', VideoTime))); + SetFontPos (5, 65); - //text:= 'vtime: ' + FormatFloat('#0.00', videodecoder^.timecode); - //test := Addr(text[1]); - glPrint(timediff); + glPrint(PChar(timediff_str)); + SetFontPos (5, 80); - glPrint(mtime); + glPrint(PChar(mtime_str)); + SetFontPos (5, 95); case fAspectCorrection of acoCrop : glPrint('Crop'); @@ -916,4 +870,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Menu/UDisplay.pas b/Game/Code/Menu/UDisplay.pas index d2027ca7..c914e0f2 100644 --- a/Game/Code/Menu/UDisplay.pas +++ b/Game/Code/Menu/UDisplay.pas @@ -93,9 +93,6 @@ begin glBindTexture(GL_TEXTURE_2D, pTex[i]); if glGetError <> GL_NO_ERROR then canFade := False; - //glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_REPLACE); - //if glGetError <> GL_NO_ERROR then canFade := False; - glTexImage2D(GL_TEXTURE_2D, 0, 3, TexW, TexH, 0, GL_RGB, GL_UNSIGNED_BYTE, nil); if glGetError <> GL_NO_ERROR then canFade := False; diff --git a/Game/Code/Menu/UMenu.pas b/Game/Code/Menu/UMenu.pas index ca91a65c..a0f8904d 100644 --- a/Game/Code/Menu/UMenu.pas +++ b/Game/Code/Menu/UMenu.pas @@ -282,8 +282,8 @@ begin if Name <> '' then begin // BackImg := Texture.LoadTexture(false, PChar(Skin.SkinPath + FileName), 'JPG', 'Plain', 0); // new theme system BackImg := Texture.GetTexture(Skin.GetTextureFileName(Name), 'Plain'); - BackImg.W := 800; - BackImg.H := 600; + BackImg.W := RenderW; + BackImg.H := RenderH; BackW := 1; BackH := 1; end; @@ -383,15 +383,11 @@ begin end; function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; -var - StatNum: integer; begin Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); end; function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; Name, Format, Typ: string): integer; -var - StatNum: integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Format, Typ, $FFFFFF); end; @@ -417,8 +413,6 @@ begin end; function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; Name, Format, Typ: string; Color: integer): integer; -var - StatNum: integer; begin Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Format, Typ, Color); end; @@ -516,7 +510,7 @@ function TMenu.AddButton(ThemeButton: TThemeButton): integer; var BT: integer; BTLen: integer; - temp: integer; + begin { Result := AddButton(ThemeButton.X, ThemeButton.Y, ThemeButton.W, ThemeButton.H, ThemeButton.ColR, ThemeButton.ColG, ThemeButton.ColB, ThemeButton.Int, @@ -636,8 +630,30 @@ begin end; procedure TMenu.ClearButtons; +var + I: Integer; + num: Integer; + begin - Setlength(Button, 0); + num := 0; + for I := 0 to Length(Interactions) - 1 do + begin + if (Interactions[I].Typ <> iButton) then + begin + Interactions[num].Typ := Interactions[I].Typ; + Interactions[num].Num := num; + Inc(num); + end; + end; + + SetLength(Interactions, num); + SetLength(Button, 0); + + //Set ButtonPos to Autoset Length + ButtonPos := -1; + SelInteraction := 0; + if(num>0) then + Interaction := 0; end; // Method to draw our TMenu and all his child buttons @@ -822,10 +838,6 @@ end; procedure TMenu.InteractCustom(CustomSwitch: integer); -var - Num: integer; - Typ: integer; - Again: boolean; begin //Code Commented atm, because it needs to be Rewritten //it doesn't work with Button Collections @@ -1445,4 +1457,3 @@ begin end; end. - diff --git a/Game/Code/Menu/UMenuButton.pas b/Game/Code/Menu/UMenuButton.pas index 03085478..b91bfd15 100644 --- a/Game/Code/Menu/UMenuButton.pas +++ b/Game/Code/Menu/UMenuButton.pas @@ -83,34 +83,14 @@ implementation uses UDrawTexture, SysUtils, windows; procedure TButton.SetX(Value: real); -var - dx: real; - T: integer; // text begin - {dY := Value - Texture.y; - - Texture.X := Value; - - for T := 0 to High(Text) do - Text[T].X := Text[T].X + dY;} - PosX := Value; if (FadeTex.TexNum = -1) then Texture.X := Value; - end; procedure TButton.SetY(Value: real); -var - dY: real; - T: integer; // text begin - {dY := Value - PosY; - - - for T := 0 to High(Text) do - Text[T].Y := Text[T].Y + dY;} - PosY := Value; if (FadeTex.TexNum = -1) then Texture.y := Value; @@ -267,6 +247,7 @@ var Tick: Cardinal; Spacing: Real; begin + T := 0; if Visible then begin //Fade Mod if Fade then @@ -485,4 +466,4 @@ begin end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Menu/UMenuSelect.pas b/Game/Code/Menu/UMenuSelect.pas index 2362ff4f..67c36111 100644 --- a/Game/Code/Menu/UMenuSelect.pas +++ b/Game/Code/Menu/UMenuSelect.pas @@ -99,8 +99,6 @@ begin end; procedure TSelect.SetSelect(Value: boolean); -var - SO: integer; begin // default 1, 0.4 SelectBool := Value; if Value then begin @@ -195,4 +193,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Menu/UMenuSelectSlide.pas b/Game/Code/Menu/UMenuSelectSlide.pas index b5d68aff..712e23cc 100644 --- a/Game/Code/Menu/UMenuSelectSlide.pas +++ b/Game/Code/Menu/UMenuSelectSlide.pas @@ -117,9 +117,6 @@ begin end; procedure TSelectSlide.SetSelect(Value: boolean); -var - SO: integer; - I: integer; begin SelectBool := Value; if Value then begin @@ -173,11 +170,10 @@ end; procedure TSelectSlide.SetSelectOpt(Value: integer); var SO: integer; - Sel: integer; HalfL: integer; HalfR: integer; -procedure DoSelection(Sel: Cardinal); +procedure DoSelection(Sel: Integer); var I: Integer; begin for I := low(TextOpt) to high(TextOpt) do @@ -205,7 +201,7 @@ begin if (Value <= 0) then begin //First Option Selected - Value := 0; + //Value := 0; for SO := low (TextOpt) to high(TextOpt) do begin @@ -216,7 +212,7 @@ begin end else if (Value >= high(TextOptT)) then begin //Last Option Selected - Value := high(TextOptT); + //Value := high(TextOptT); for SO := high(TextOpt) downto low (TextOpt) do begin @@ -342,4 +338,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Menu/UMenuStatic.pas b/Game/Code/Menu/UMenuStatic.pas index 758869e6..b877b6a6 100644 --- a/Game/Code/Menu/UMenuStatic.pas +++ b/Game/Code/Menu/UMenuStatic.pas @@ -21,8 +21,6 @@ implementation uses UDrawTexture; procedure TStatic.Draw; -var - Pet: integer; begin if Visible then begin @@ -81,4 +79,4 @@ begin Texture := Textura; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Menu/UMenuText.pas b/Game/Code/Menu/UMenuText.pas index 315a7302..8409b09f 100644 --- a/Game/Code/Menu/UMenuText.pas +++ b/Game/Code/Menu/UMenuText.pas @@ -73,7 +73,7 @@ var Function GetNextPos: Boolean; var - T1, T2, T3: Cardinal; + T1, T3: Cardinal; begin LastPos := NextPos; @@ -321,4 +321,4 @@ begin end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenCredits.pas b/Game/Code/Screens/UScreenCredits.pas index 96eb1642..f20a0797 100644 --- a/Game/Code/Screens/UScreenCredits.pas +++ b/Game/Code/Screens/UScreenCredits.pas @@ -3,7 +3,7 @@ unit UScreenCredits; interface uses - UMenu, SDL, UDisplay, UTexture, gl, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UGraphicClasses; + UMenu, SDL, UDisplay, UTexture, gl, UMusic, UFiles, SysUtils, UThemes, UGraphicClasses; type TCreditsStages=(InitialDelay,Intro,MainPart,Outro); @@ -159,6 +159,7 @@ end; function TScreenCredits.Draw: boolean; begin DrawCredits; + Result := true; end; procedure TScreenCredits.onShow; @@ -180,7 +181,7 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S,I, Len: Integer; + S{,I, Len}: Integer; X,Y,A: Real; visibleText: PChar; begin @@ -479,7 +480,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -532,7 +533,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -590,7 +591,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -643,7 +644,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -699,7 +700,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -758,7 +759,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -814,7 +815,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -872,7 +873,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -898,7 +899,7 @@ Data := Music.GetFFTData; end; if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin j:=CTime-(STime+Delay-10); - f:=j*10.0; + //f:=j*10.0; gltranslatef(0,-223,0); glrotatef(j*-9,0,0,1); gltranslatef(0,223,0); @@ -931,7 +932,7 @@ Data := Music.GetFFTData; if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); if ESC_Alpha >20 then ESC_Alpha:=20; if ((CTime-STime)<20) then ESC_Alpha:=20; - k:=CTime-STime; + //k:=CTime-STime; if CTime <=STime+10 then j:=CTime-STime else j:=10; if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; glColor4f(1, 1, 1, ESC_Alpha/20*j/10); @@ -1107,4 +1108,4 @@ Data := Music.GetFFTData; // Draw_FunkyText; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenEditConvert.pas b/Game/Code/Screens/UScreenEditConvert.pas index d19d95e3..4fbd73a2 100644 --- a/Game/Code/Screens/UScreenEditConvert.pas +++ b/Game/Code/Screens/UScreenEditConvert.pas @@ -71,8 +71,8 @@ implementation uses UGraphic, SysUtils, UDrawTexture, TextGL, UFiles, UMain, UIni, gl, USkins; function TScreenEditConvert.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - T: integer; +{var + T: integer;} begin Result := true; If (PressedDown) Then diff --git a/Game/Code/Screens/UScreenEditSub.pas b/Game/Code/Screens/UScreenEditSub.pas index a0c89637..5570e965 100644 --- a/Game/Code/Screens/UScreenEditSub.pas +++ b/Game/Code/Screens/UScreenEditSub.pas @@ -2,7 +2,7 @@ unit UScreenEditSub; interface -uses UMenu, UVideo, TextGL, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UVideo, TextGL, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, gl, UThemes, MidiOut, UHelp; type @@ -1136,7 +1136,7 @@ end; function TScreenEditSub.ParseInputEditBPM(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var - SDL_ModState: Word; + //SDL_ModState: Word; strBPM: string; temp: real; @@ -1144,8 +1144,8 @@ 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}); + //SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + // + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); // check normal keys if (ScanCode in [48..57, 44]) then @@ -1339,7 +1339,7 @@ end; procedure TScreenEditSub.LyricsCapitalize; var C: integer; - N: integer; // temporary + //N: integer; // temporary S: string; begin // temporary @@ -1936,9 +1936,9 @@ end; function TScreenEditSub.Draw: boolean; var - Min: integer; - Sec: integer; - Tekst: string; + //Min: integer; + //Sec: integer; + //Tekst: string; Pet: integer; PlayClick: boolean; line, note: integer; @@ -2387,14 +2387,14 @@ end; procedure TScreenEditSub.DrawInfoBar(x, y, w, h: integer); var - start, end_: integer; - ww: integer; + start, end_: integer; + ww: integer; - pos: real; - br: real; + pos: real; + br: real; - line, note: integer; - numLines, numNotes: integer; + line: integer; + numLines: integer; begin numLines := Length(Czesci[0].Czesc); @@ -2564,4 +2564,4 @@ begin Result := 0; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenLevel.pas b/Game/Code/Screens/UScreenLevel.pas index 856e0cf1..145a3b2a 100644 --- a/Game/Code/Screens/UScreenLevel.pas +++ b/Game/Code/Screens/UScreenLevel.pas @@ -22,12 +22,12 @@ implementation uses UGraphic, UMain, UIni, UTexture, ULog; function TScreenLevel.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; -var - SDL_ModState: Word; +{var + SDL_ModState: Word; } begin Result := true; - SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT - + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT {+ KMOD_CAPS}); + //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 @@ -71,8 +71,6 @@ begin end; constructor TScreenLevel.Create; -var - I: integer; begin inherited Create; @@ -101,4 +99,4 @@ begin Button[2].Texture.ScaleW := Progress; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenLoading.pas b/Game/Code/Screens/UScreenLoading.pas index 82dfdab2..49dc961b 100644 --- a/Game/Code/Screens/UScreenLoading.pas +++ b/Game/Code/Screens/UScreenLoading.pas @@ -17,7 +17,7 @@ type implementation -uses UGraphic, UTime; +uses UGraphic, UTime, UDisplay; function TScreenLoading.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; begin diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas index 91a9e620..b21a4778 100644 --- a/Game/Code/Screens/UScreenMain.pas +++ b/Game/Code/Screens/UScreenMain.pas @@ -3,7 +3,7 @@ unit UScreenMain; interface uses - UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, ULCD, ULight, UHelp; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes, UHelp; type TScreenMain = class(TMenu) @@ -20,7 +20,6 @@ type procedure InteractPrev; override; procedure InteractInc; override; procedure InteractDec; override; - procedure UpdateLCD; procedure SetAnimationProgress(Progress: real); override; //function Draw: boolean; override; end; @@ -35,8 +34,8 @@ uses Windows, UPlaylist, UGraphic, UMain, UIni, UTexture, USongs, Textgl, opengl function TScreenMain.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var -I: Integer; SDL_ModState: Word; + begin Result := true; @@ -235,8 +234,6 @@ begin end; constructor TScreenMain.Create; -var - I: integer; begin inherited Create; @@ -269,8 +266,6 @@ end; procedure TScreenMain.onShow; begin - LCD.WriteText(1, ' Choose mode: '); - UpdateLCD; ScreenSong.Mode := smNormal; ScreenSong.SongIndex := -1; PlaylistMan.Mode := 0; @@ -289,8 +284,6 @@ begin inherited InteractNext; Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); end; procedure TScreenMain.InteractPrev; @@ -298,8 +291,6 @@ begin inherited InteractPrev; Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); end; procedure TScreenMain.InteractDec; @@ -307,8 +298,6 @@ begin inherited InteractDec; Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(0, 200); end; procedure TScreenMain.InteractInc; @@ -316,18 +305,6 @@ begin inherited InteractInc; Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; - UpdateLCD; - Light.LightOne(1, 200); -end; - -procedure TScreenMain.UpdateLCD; -begin - case Interaction of - 0: LCD.WriteText(2, ' sing '); - 1: LCD.WriteText(2, ' multi '); - 2: LCD.WriteText(2, ' options '); - 3: LCD.WriteText(2, ' exit '); - end end; procedure TScreenMain.SetAnimationProgress(Progress: real); @@ -335,4 +312,4 @@ begin Static[0].Texture.ScaleW := Progress; Static[0].Texture.ScaleH := Progress; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOpen.pas b/Game/Code/Screens/UScreenOpen.pas index 6b80354c..97252b2b 100644 --- a/Game/Code/Screens/UScreenOpen.pas +++ b/Game/Code/Screens/UScreenOpen.pas @@ -2,13 +2,13 @@ unit UScreenOpen; interface -uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, USmpeg, UTexture, UMenuText, +uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, UMenuText, ULyrics, Math, gl, UThemes; type TScreenOpen = class(TMenu) private - TextF: array[0..1] of integer; + //TextF: array[0..1] of integer; TextN: integer; public Tex_Background: TTexture; @@ -162,4 +162,3 @@ begin end;*) end. - diff --git a/Game/Code/Screens/UScreenOptions.pas b/Game/Code/Screens/UScreenOptions.pas index ee4c2cba..3e9a4ff7 100644 --- a/Game/Code/Screens/UScreenOptions.pas +++ b/Game/Code/Screens/UScreenOptions.pas @@ -102,8 +102,6 @@ begin end; constructor TScreenOptions.Create; -var - I: integer; begin inherited Create; @@ -177,4 +175,4 @@ begin Button[7].Texture.ScaleW := Progress; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsAdvanced.pas b/Game/Code/Screens/UScreenOptionsAdvanced.pas index c364ca20..7c89ed34 100644 --- a/Game/Code/Screens/UScreenOptionsAdvanced.pas +++ b/Game/Code/Screens/UScreenOptionsAdvanced.pas @@ -79,8 +79,8 @@ begin end; constructor TScreenOptionsAdvanced.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; diff --git a/Game/Code/Screens/UScreenOptionsGame.pas b/Game/Code/Screens/UScreenOptionsGame.pas index c9268931..a77ce5b3 100644 --- a/Game/Code/Screens/UScreenOptionsGame.pas +++ b/Game/Code/Screens/UScreenOptionsGame.pas @@ -75,17 +75,11 @@ begin end; constructor TScreenOptionsGame.Create; -var - I: integer; begin inherited Create; LoadFromTheme(Theme.OptionsGame); - //Refresh Songs Patch - old_Sorting := Ini.Sorting; - old_Tabs := Ini.Tabs; - AddSelect(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); AddSelect(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); @@ -104,8 +98,12 @@ end; //Refresh Songs Patch procedure TScreenOptionsGame.RefreshSongs; begin -if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then - ScreenSong.Refresh; + if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then + begin + //Tabs at Startup fix + Ini.Tabs_at_startup := Ini.Tabs; + ScreenSong.Refresh(false); + end; end; procedure TScreenOptionsGame.onShow; @@ -113,6 +111,10 @@ begin // Interaction := 0; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsGame)'); + + //Refresh Songs Patch + old_Sorting := Ini.Sorting; + old_Tabs := Ini.Tabs; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsGraphics.pas b/Game/Code/Screens/UScreenOptionsGraphics.pas index 58e40c23..ee6e96f9 100644 --- a/Game/Code/Screens/UScreenOptionsGraphics.pas +++ b/Game/Code/Screens/UScreenOptionsGraphics.pas @@ -76,8 +76,6 @@ begin end; constructor TScreenOptionsGraphics.Create; -var - I: integer; begin inherited Create; @@ -104,4 +102,4 @@ begin Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsGraphics)'); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsLyrics.pas b/Game/Code/Screens/UScreenOptionsLyrics.pas index aeeb01a4..a6ee2464 100644 --- a/Game/Code/Screens/UScreenOptionsLyrics.pas +++ b/Game/Code/Screens/UScreenOptionsLyrics.pas @@ -73,8 +73,6 @@ begin end; constructor TScreenOptionsLyrics.Create; -var - I: integer; begin inherited Create; @@ -98,4 +96,4 @@ begin Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsLyrics)'); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas index 8dda4a6f..c4c43674 100644 --- a/Game/Code/Screens/UScreenOptionsRecord.pas +++ b/Game/Code/Screens/UScreenOptionsRecord.pas @@ -81,7 +81,7 @@ end; constructor TScreenOptionsRecord.Create; var - I: integer; + //I: integer; SC: integer; SCI: integer; begin diff --git a/Game/Code/Screens/UScreenOptionsSound.pas b/Game/Code/Screens/UScreenOptionsSound.pas index f2b94e73..6735abea 100644 --- a/Game/Code/Screens/UScreenOptionsSound.pas +++ b/Game/Code/Screens/UScreenOptionsSound.pas @@ -73,8 +73,6 @@ begin end; constructor TScreenOptionsSound.Create; -var - I: integer; begin inherited Create; @@ -104,4 +102,4 @@ begin Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsSound)'); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenOptionsThemes.pas b/Game/Code/Screens/UScreenOptionsThemes.pas index 320baa83..9a65aae0 100644 --- a/Game/Code/Screens/UScreenOptionsThemes.pas +++ b/Game/Code/Screens/UScreenOptionsThemes.pas @@ -9,8 +9,10 @@ type TScreenOptionsThemes = class(TMenu) private procedure ReloadTheme; + public - SkinSelect: Integer; + AktualTheme: Integer; + SkinSelect: Integer; constructor Create; override; function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; procedure onShow; override; @@ -46,10 +48,12 @@ begin Ini.Save; // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens( false ); - + if(AktualTheme<>Ini.Theme) then + begin + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens( true ); + ScreenSong.Refresh(true); + end; Music.PlayBack; FadeTo(@ScreenOptions); end; @@ -60,10 +64,12 @@ begin Ini.Save; // Reload all screens, after Theme changed - // Todo : JB - Check if theme was actually changed - UGraphic.UnLoadScreens(); - UGraphic.LoadScreens( false ); - + if(AktualTheme<>Ini.Theme) then + begin + UGraphic.UnLoadScreens(); + UGraphic.LoadScreens( true ); + ScreenSong.Refresh(true); + end; Music.PlayBack; FadeTo(@ScreenOptions); end; @@ -119,8 +125,8 @@ begin end; constructor TScreenOptionsThemes.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; @@ -143,6 +149,8 @@ begin Interaction := 0; if not Help.SetHelpID(ID) then Log.LogError('No Entry for Help-ID ' + ID + ' (ScreenOptionsThemes)'); + + AktualTheme := Ini.Theme; end; procedure TScreenOptionsThemes.ReloadTheme; @@ -160,6 +168,8 @@ begin Display.Draw; SwapBuffers; + ScreenOptionsThemes.AktualTheme := self.AktualTheme; + freeandnil( self ); end; diff --git a/Game/Code/Screens/UScreenPartyNewRound.pas b/Game/Code/Screens/UScreenPartyNewRound.pas index 91ae0e64..7c043b7e 100644 --- a/Game/Code/Screens/UScreenPartyNewRound.pas +++ b/Game/Code/Screens/UScreenPartyNewRound.pas @@ -112,8 +112,8 @@ begin end; constructor TScreenPartyNewRound.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; @@ -171,8 +171,8 @@ begin end; procedure TScreenPartyNewRound.onShow; -var - I: Integer; +//var + //I: Integer; function GetTeamPlayers(const Num: Byte): String; var Players: Array of String; @@ -322,7 +322,7 @@ var T: Integer; NumRounds: Integer; begin - N:=0; + //N:=0; //current round-number R:=PartySession.CurRound; diff --git a/Game/Code/Screens/UScreenPartyNewRoundM2.pas b/Game/Code/Screens/UScreenPartyNewRoundM2.pas index ee5c8a90..7fe94ac2 100644 --- a/Game/Code/Screens/UScreenPartyNewRoundM2.pas +++ b/Game/Code/Screens/UScreenPartyNewRoundM2.pas @@ -237,7 +237,6 @@ var T: Integer; NumRounds: Integer; begin - N:=0; //current round-number R:=PartySessionM2.CurRound; @@ -310,4 +309,4 @@ begin Button[2].Texture.ScaleW := Progress; } end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenPartyOptions.pas b/Game/Code/Screens/UScreenPartyOptions.pas index d6c2d71a..8576b596 100644 --- a/Game/Code/Screens/UScreenPartyOptions.pas +++ b/Game/Code/Screens/UScreenPartyOptions.pas @@ -437,8 +437,8 @@ begin end; constructor TScreenPartyOptions.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; //Fill IPlaylist diff --git a/Game/Code/Screens/UScreenPartyOptionsM2.pas b/Game/Code/Screens/UScreenPartyOptionsM2.pas index 472b2c16..7a8f5f2b 100644 --- a/Game/Code/Screens/UScreenPartyOptionsM2.pas +++ b/Game/Code/Screens/UScreenPartyOptionsM2.pas @@ -802,6 +802,8 @@ begin if MenuPluginOpen then Draw_MenuPlugin; + + Result := true; end; procedure TScreenPartyOptionsM2.SetAnimationProgress(Progress: real); diff --git a/Game/Code/Screens/UScreenPartyPlayerM2.pas b/Game/Code/Screens/UScreenPartyPlayerM2.pas index 6ee9d1df..da96bf30 100644 --- a/Game/Code/Screens/UScreenPartyPlayerM2.pas +++ b/Game/Code/Screens/UScreenPartyPlayerM2.pas @@ -23,7 +23,7 @@ uses UGraphic, UMain, UIni, UTexture, UPartyM2, UHelp, ULog; function TScreenPartyPlayerM2.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; var - I, J: integer; + {I,} J: integer; SDL_ModState: Word; procedure IntNext; begin @@ -40,11 +40,11 @@ var 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); - begin // Key Down + case PressedKey of SDLK_TAB: begin @@ -204,8 +204,8 @@ begin end; constructor TScreenPartyPlayerM2.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; diff --git a/Game/Code/Screens/UScreenPartyScore.pas b/Game/Code/Screens/UScreenPartyScore.pas index faed2964..9dc824fb 100644 --- a/Game/Code/Screens/UScreenPartyScore.pas +++ b/Game/Code/Screens/UScreenPartyScore.pas @@ -88,7 +88,7 @@ end; constructor TScreenPartyScore.Create; var - I: integer; + //I: integer; Tex: TTexture; R, G, B: Real; Color: Integer; diff --git a/Game/Code/Screens/UScreenPartyWin.pas b/Game/Code/Screens/UScreenPartyWin.pas index d7c26d30..057c1f8a 100644 --- a/Game/Code/Screens/UScreenPartyWin.pas +++ b/Game/Code/Screens/UScreenPartyWin.pas @@ -71,8 +71,8 @@ begin end; constructor TScreenPartyWin.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; diff --git a/Game/Code/Screens/UScreenPopup.pas b/Game/Code/Screens/UScreenPopup.pas index 417f59bb..24aec1b4 100644 --- a/Game/Code/Screens/UScreenPopup.pas +++ b/Game/Code/Screens/UScreenPopup.pas @@ -18,8 +18,8 @@ type end; TScreenPopupError = class(TMenu) - private - CurMenu: Byte; //Num of the cur. Shown Menu + {private + CurMenu: Byte; //Num of the cur. Shown Menu} public Visible: Boolean; //Whether the Menu should be Drawn @@ -356,7 +356,7 @@ begin glColor4f(0.2, 0.2, 0.2, 0.8); glVertex2f(Rect.left-5, Rect.bottom+5); glEnd; glDisable(GL_BLEND); - //glScissor(Rect.left-1, ScreenH-Rect.bottom-1, Rect.right-Rect.left+2, Rect.bottom-Rect.top+2); + glScissor(Rect.left-1, ScreenH-Rect.bottom-1, Rect.right-Rect.left+2, Rect.bottom-Rect.top+2); glScissor(round((Rect.left-1)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(ScreenAct-1)), round((RenderH-Rect.bottom-1)*ScreenH/RenderH), round((Rect.right-Rect.left+2)*(ScreenW/Screens)/RenderW), @@ -787,35 +787,28 @@ end; procedure TScreenPopupHelp.DrawLine(line, index, Y: integer); begin - //glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); glLineWidth(2); glBegin(GL_LINES); glVertex2f(TextsGFX[line].lines[index].fX, TextsGFX[line].lines[index].fY - Y); glVertex2f(TextsGFX[line].lines[index].tX, TextsGFX[line].lines[index].tY - Y); glEnd; - //glDisable(GL_BLEND); end; procedure TScreenPopupHelp.DrawText(line, index, Y: integer); -var - text: PChar; - begin glColor4f(1, 1, 1, 1); SetFontStyle(TextsGFX[line].texts[index].Style); SetFontItalic(TextsGFX[line].texts[index].Italic); SetFontSize(TextsGFX[line].texts[index].Size); SetFontPos (TextsGFX[line].texts[index].X, TextsGFX[line].texts[index].Y - Y); - text := Addr(TextsGFX[line].texts[index].text[1]); - glPrint(text); + glPrint(PChar(TextsGFX[line].texts[index].text)); end; procedure TScreenPopupHelp.DrawScroll(X, Y, W, H: integer; pos, len: double); var fY, tY: double; begin - //glEnable(GL_BLEND); glColor4f(1, 1, 1, 1); glLineWidth(1); @@ -837,7 +830,6 @@ begin glVertex2f(X+W, tY); glVertex2f(X, tY); glEnd; - //glDisable(GL_BLEND); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenScore.pas b/Game/Code/Screens/UScreenScore.pas index ca2ec78b..4101aef9 100644 --- a/Game/Code/Screens/UScreenScore.pas +++ b/Game/Code/Screens/UScreenScore.pas @@ -3,7 +3,7 @@ unit UScreenScore; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, gl; + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, gl; type THandler = record @@ -368,11 +368,6 @@ begin RefreshTexts; - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Ini.Name[0]); - LCD.WriteText(2, 'Score: ' + Text[TextTotalScore[1]].Text); - MP3VolumeHandler.changed := false; if not (Ini.SavePlayback=1) then StartPreview @@ -642,4 +637,4 @@ begin end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas index 43ad1dde..c6d83fd0 100644 --- a/Game/Code/Screens/UScreenSing.pas +++ b/Game/Code/Screens/UScreenSing.pas @@ -3,7 +3,7 @@ unit UScreenSing; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, gl, BASS, UThemes, ULCD, UGraphicClasses, UVideo; + TextGL, gl, BASS, UThemes, UGraphicClasses, UVideo; type THandler = record @@ -93,7 +93,6 @@ type function ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure Finish; virtual; - procedure UpdateLCD; procedure Pause; //Pause Mod(Toggles Pause) //OnSentenceEnd for LineBonus + Singbar @@ -249,17 +248,11 @@ end; //Pause Mod End constructor TScreenSing.Create; -var - I: integer; - P: integer; begin inherited Create; LoadFromTheme(Theme.Sing); - // time - //TextTime := AddText(75, 14, 1, 8, 0.25, 0.25, 0.25, '00:00'); - //TimeBar mod StaticTimeProgress := AddStatic(Theme.Sing.StaticTimeProgress); TextTimeText := AddText(Theme.Sing.TextTimeText); @@ -323,7 +316,6 @@ end; procedure TScreenSing.onShow; var - P: integer; V1: boolean; V1TwoP: boolean; //added for ps3 skin V1ThreeP: boolean; //added for ps3 skin @@ -405,7 +397,14 @@ begin V2M := true; V3R := true; end; - + else begin //should not happen + V1 := true; + V1TwoP := false; + V1ThreeP := false; + V2R := false; + V2M := false; + V3R := false; + end; end; //Added for ps3 skin @@ -761,7 +760,7 @@ end; procedure TScreenSing.SongError; var - I, K, len: integer; + I, len: integer; begin if (not ScreenSong.PartyMedley) and (ScreenSong.Mode <> smMedley) then @@ -815,7 +814,7 @@ end; procedure TScreenSing.LoadNextSong; var P, I: integer; - numNotes: integer; + begin // load notes ResetSingTemp; @@ -844,7 +843,6 @@ begin end; AktSong.Path := CatSongs.Song[CatSongs.Selected].Path; - // AktSong.GAP := AktSong.GAP + 40 {4096 = 100ms for buffer} + 20 {microphone} + 60000 / AktSong.BPM[0].BPM / 2; // temporary until UMain will be fixed if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then begin @@ -863,7 +861,6 @@ begin if MedleyStart<0 then MedleyStart := 0; - //that one is better: MedleyEnd := GetTimeFromBeat(AktSong.Medley.EndBeat) + AktSong.Medley.FadeOut_time; end; @@ -895,8 +892,6 @@ begin Tex_Background.TexNum := -1; // play music+timer (I) - Music.CaptureStart; - if (ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley then begin Music.MoveTo(MedleyStart); @@ -924,14 +919,12 @@ begin LyricSub.AddCzesc(1); LyricSub.Selected := -1; - UpdateLCD; - //Deactivate Pause Paused := False; //Kill all Stars not Killed yet //GoldenStarsTwinkle Mod - GoldenRec.SentenceChange; + GoldenRec.SentenceChange; //GoldenStarsTwinkle Mod End //Set Num of Empty Sentences for Phrasen Bonus @@ -952,6 +945,8 @@ begin Text[SongNameText].Visible := false; end; + Music.CaptureStart; + if ((ScreenSong.Mode = smMedley) or ScreenSong.PartyMedley) and (PlaylistMedley.CurrentMedleySong>1) then onShowFinish; @@ -1367,13 +1362,37 @@ begin DrawVolumeBar(10, 475, 782, 12, MP3Volume); end else MP3VolumeHandler.changed := false; + + + if (Ini.Debug=1) then + begin + glEnable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glColor4f(1, 1, 1, 0.6); + glBegin(GL_QUADS); + glVertex2f(0, 180); + glVertex2f(0, 210); + glVertex2f(400, 210); + glVertex2f(400, 180); + glEnd; + glDisable(GL_BLEND); + + SetFontStyle(1); + SetFontItalic(false); + SetFontSize(8); + glColor4f(0, 0, 0, 1); + + SetFontPos (5, 184); + glPrint(PChar('lt: ' + FormatFloat('#0.00', Czas.Teraz) + + ' mt: ' + FormatFloat('#0.00', Music.Position) + + ' dt: ' + FormatFloat('#0.000', Czas.Teraz-Music.Position))); + end; end; procedure TScreenSing.UpdateMedleyStats(medley_end: boolean); var len, num, I : integer; - lastline: boolean; - vol: real; + begin len := Length(PlaylistMedley.Stats); num := PlaylistMedley.NumPlayer; @@ -1498,7 +1517,7 @@ begin PlaylistMedley.Stats[len].Player[I].ScoreLine / len); PlaylistMedley.Stats[len].Player[I].ScoreGolden := round( - PlaylistMedley.Stats[J].Player[I].ScoreGolden / len); + PlaylistMedley.Stats[len].Player[I].ScoreGolden / len); PlaylistMedley.Stats[len].Player[I].ScoreI := round( PlaylistMedley.Stats[len].Player[I].ScoreI / len); @@ -1551,22 +1570,6 @@ begin end; end; -procedure TScreenSing.UpdateLCD; -var - T: string; -begin - LCD.HideCursor; - LCD.Clear; - - T := LyricMain.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); - - T := LyricSub.Text; - if Copy(T, Length(T), 1) <> ' ' then T := T + ' '; - LCD.AddTextBR(T); -end; - procedure TScreenSing.onSentenceEnd(S: Cardinal); var I: Integer; @@ -1686,28 +1689,27 @@ end; procedure TScreenSing.DrawMedleyCountdown(); var - txt: PChar; w, h: real; timeDiff: real; t: real; + begin if (Czas.Teraz < GetTimeFromBeat(AktSong.Medley.StartBeat)) then begin timeDiff := GetTimeFromBeat(AktSong.Medley.StartBeat)-Czas.Teraz+1; t := frac(timeDiff); - CountDownText := IntToStr(round(timeDiff-t)); + glColor4f(0.15, 0.30, 0.6, t); - h := 130*t*ScreenH/RenderH; + h := 100*t*ScreenH/RenderH; SetFontStyle(1); SetFontItalic(false); SetFontSize(h); w := glTextWidth(PChar(CountDownText)); SetFontPos (RenderW/2-w/2, RenderH/2-h/2*3); - txt := Addr(CountDownText[1]); - glPrint(txt); + glPrint(PChar(IntToStr(round(timeDiff-t)))); end; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenSingModi.pas b/Game/Code/Screens/UScreenSingModi.pas index f1ab96e5..6010aed8 100644 --- a/Game/Code/Screens/UScreenSingModi.pas +++ b/Game/Code/Screens/UScreenSingModi.pas @@ -3,7 +3,7 @@ unit UScreenSingModi; interface uses UMenu, UMusic, SDL, SysUtils, UFiles, UTime, USongs, UIni, ULog, UTexture, ULyrics, - TextGL, gl, BASS, UThemes, ULCD, UScreenSing, ModiSDK, UVideo; + TextGL, gl, BASS, UThemes, UScreenSing, ModiSDK, UVideo; type TScreenSingModi = class(TScreenSing) @@ -528,7 +528,7 @@ end; //ShowScore if DLLMan.Selected.LoadSong then begin // update static menu with time ... - CurTime := Czas.Razem - Czas.Teraz; + //CurTime := Czas.Razem - Czas.Teraz; // update static menu with time ... if ScreenSong.PartyMedley then @@ -775,4 +775,4 @@ begin Music.PlayCustomSound(Index); end; -end. +end. \ No newline at end of file diff --git a/Game/Code/Screens/UScreenSong.pas b/Game/Code/Screens/UScreenSong.pas index 8516c012..0777e68d 100644 --- a/Game/Code/Screens/UScreenSong.pas +++ b/Game/Code/Screens/UScreenSong.pas @@ -3,8 +3,22 @@ unit UScreenSong; interface uses - UMenu, TextGL, SDL, UMusic, UDraw, UFiles, UTime, UDisplay, USongs, SysUtils, ULog, UThemes, UTexture, ULanguage, - ULCD, ULight, UIni, UVideo; + UMenu, + TextGL, + SDL, + UMusic, + UDraw, + UFiles, + UTime, + UDisplay, + USongs, + SysUtils, + ULog, + UThemes, + UTexture, + ULanguage, + UIni, + UVideo; type TVisArr = array of integer; @@ -137,16 +151,15 @@ type procedure onHide; override; procedure SelectNext; procedure SelectPrev; - procedure UpdateLCD; procedure SkipTo(Target: Cardinal); procedure RandomSongChallenge(); - procedure SkipTo2(Target: Cardinal); //skipt exactly to the target song nr. + procedure SkipTo2(Target: Integer); //skipt exactly to the target song nr. procedure FixSelected; //Show Wrong Song when Tabs on Fix procedure FixSelected2; //Show Wrong Song when Tabs on Fix procedure ShowCatTL(Cat: Integer);// Show Cat in Top left procedure ShowCatTLCustom(Caption: String);// Show Custom Text in Top left procedure HideCatTL;// Show Cat in Tob left - procedure Refresh; //Refresh Song Sorting + procedure Refresh(GiveStats: boolean); //Refresh Song Sorting procedure DrawEqualizer; procedure ChangeMusic; procedure LoadTop; @@ -337,7 +350,6 @@ function TScreenSong.ParseInput(PressedKey: Cardinal; ScanCode: byte; PressedDow var I: integer; I2: integer; - HS: integer; SDL_ModState: Word; Letter: Char; VisArr: array of integer; @@ -359,7 +371,8 @@ begin If (PressedDown) Then begin // Key Down - if (WaitHandler.active) and not (PressedKey = SDLK_RETURN) then + if (WaitHandler.active) and not (PressedKey IN [SDLK_RETURN, SDLK_TAB, SDLK_F, + SDLK_A, SDLK_E, SDLK_K, SDLK_M, SDLK_P, SDLK_S, SDLK_V]) then begin if (Ini.Tabs_at_startup=1) then begin @@ -392,7 +405,8 @@ begin if (WaitHandler.active) then begin WaitHandler.active := false; - if (PressedKey<>SDLK_RETURN) then + if (not PressedKey IN [SDLK_RETURN, SDLK_TAB, SDLK_F, + SDLK_A, SDLK_E, SDLK_K, SDLK_M, SDLK_P, SDLK_S, SDLK_V]) then Exit; end; end; @@ -421,7 +435,6 @@ begin ChangeMusic; SetScroll4; - UpdateLCD; //Break and Exit Exit; end; @@ -440,7 +453,6 @@ begin ChangeMusic; SetScroll4; - UpdateLCD; //Break and Exit Exit; @@ -547,6 +559,7 @@ begin SDLK_F: begin + WaitHandler.change_time := 0; if (Mode = smNormal) and (SDL_ModState = KMOD_LSHIFT) and MakeMedley then begin if Length(PlaylistMedley.Song)>0 then @@ -567,6 +580,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin + WaitHandler.change_time := 0; if (Mode = smNormal) or ((Mode = smChallenge) and not PartyMedley and not FoundCAT) then begin //On Escape goto Cat-List Hack @@ -683,6 +697,8 @@ begin end; end else begin + WaitHandler.changed := false; + CatSongs.Selected := Interaction; //Do the Action that is specified in Ini case Ini.OnSongClick of 0: StartSong; @@ -723,6 +739,8 @@ begin begin if (Length(Songs.Song) > 0) and (Mode <> smChallenge) then begin //not in M2-Mode if (Mode = smNormal) then begin + WaitHandler.changed := false; + CatSongs.Selected := Interaction; if not CatSongs.Song[Interaction].Main then begin // clicked on Song if CatSongs.CatNumShow = -3 then ScreenSongMenu.MenuShow(SM_Playlist) @@ -740,8 +758,11 @@ begin SDLK_P: //Show Playlist Menu begin - if (Length(Songs.Song) > 0) AND (Mode = smNormal) then begin //not in party-modes - ScreenSongMenu.MenuShow(SM_Playlist_Load); + if (Length(Songs.Song) > 0) AND (Mode = smNormal) then + begin //not in party-modes + WaitHandler.changed := false; + CatSongs.Selected := Interaction; + ScreenSongMenu.MenuShow(SM_Playlist_Load); end; end; @@ -750,6 +771,8 @@ begin if (Length(Songs.Song) > 0) AND (Mode = smNormal) then //not in party-modes begin VidVis := windowed; + WaitHandler.changed := false; + CatSongs.Selected := Interaction; ScreenSongJumpto.Visible := True; end else if (Mode=smChallenge) and not PartyMedley then //M2-MOD-mode DoJokerM2 @@ -849,8 +872,6 @@ begin SelectNext; ChangeMusic; SetScroll4; - UpdateLCD; - Light.LightOne(1, 200); end; end; @@ -863,15 +884,16 @@ begin SelectPrev; ChangeMusic; SetScroll4; - UpdateLCD; - Light.LightOne(0, 200); end; end; SDLK_E: begin if (Mode = smNormal) then + begin + WaitHandler.changed := false; OpenEditor; + end; end; SDLK_R: @@ -1117,7 +1139,7 @@ constructor TScreenSong.Create; var Pet: integer; I: integer; -Label CreateSongButtons; + begin inherited Create; @@ -1203,88 +1225,19 @@ begin // Song List // Songs.LoadSongList; // moved to the UltraStar unit - CatSongs.Refresh; - - if (length(CatSongs.Song) > 0) then - begin - //Set Length of Button Array one Time Instead of one time for every Song - SetButtonLength(Length(CatSongs.Song)); - - I := 0; - CreateSongButtons: - - try - for Pet := I to High(CatSongs.Song) do begin // creating all buttons - // new - Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 - - if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then - CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' - - if CatSongs.Song[Pet].Cover = '' then - AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) - else begin - // cache texture if there is a need to this - if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin - Texture.CreateCacheMipmap := true; - Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap - Texture.CreateCacheMipmap := false; - - // puts this texture to the cache file - Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); - - // unload full size texture - Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); - - // we should also add mipmap texture by calling createtexture and use mipmap cache as data source - end; - - // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) - AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); - end; - Texture.Limit := 1024*1024; - I := -1; - end; - except - //When Error is reported the First time for this Song - if (I <> Pet) then - begin - //Some Error reporting: - Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); - - //Change Cover to NoCover and Continue Loading - CatSongs.Song[Pet].Cover := ''; - I := Pet; - end - else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song - begin - Log.LogError('NoCover Cover is damaged!'); - try - AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); - except - Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); - Halt; - end; - I := Pet + 1; - end; - end; - - if (I <> -1) then - GoTo CreateSongButtons; + + //Refresh; - end; // Randomize Patch Randomize; //Equalizer SetLength(EqualizerBands, Theme.Song.Equalizer.Bands); + //ClearArray For I := low(EqualizerBands) to high(EqualizerBands) do EqualizerBands[I] := 3; - if (Length(CatSongs.Song) > 0) then - Interaction := 0; - MP3Volume := Ini.PreviewVolume * 10; end; @@ -1494,8 +1447,8 @@ end; procedure TScreenSong.SetScroll1; var B: integer; // button - BMin: integer; // button min - BMax: integer; // button max + //BMin: integer; // button min + //BMax: integer; // button max Src: integer; // Dst: integer; Count: integer; // Dst is not used. Count is used. @@ -1630,8 +1583,8 @@ end; procedure TScreenSong.SetScroll2; var B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; + //Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + //Wsp2: real; begin // liniowe for B := 0 to High(Button) do @@ -1657,8 +1610,8 @@ end; procedure TScreenSong.SetScroll3; // with slide var B: integer; - Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu - Wsp2: real; + //Wsp: integer; // wspolczynnik przesuniecia wzgledem srodka ekranu + //Wsp2: real; begin SongTarget := Interaction; @@ -1720,7 +1673,7 @@ begin end; end; end; - +{ old version procedure TScreenSong.SetScroll5; // rotate var B: integer; @@ -1731,14 +1684,6 @@ var X: Real; begin VS := CatSongs.VisibleSongs; // cache Visible Songs - {Vars - Theme.Song.CoverW: Radius des Kreises - Theme.Song.CoverX: X Pos Linke Kante des gewählten Covers - Theme.Song.CoverX: Y Pos Obere Kante des gewählten Covers - Theme.Song.CoverH: Höhe der Cover - - (CatSongs.VisibleIndex(B) - SongCurrent)/VS = Abstand zum MIttleren Cover in % - } //Change Pos of all Buttons for B := low(Button) to high(Button) do @@ -1752,7 +1697,7 @@ begin else if (Pos > VS/2) then Pos := Pos - VS; - if (Abs(Pos) < 2.5) then {fixed Positions} + if (Abs(Pos) < 2.5) then //fixed Positions begin Angle := Pi * (Pos / 5); //Button[B].Visible := False; @@ -1764,7 +1709,8 @@ begin Button[B].Z := 0.95 - Abs(Pos) * 0.01; - Button[B].Y := (Theme.Song.Cover.Y + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); + Button[B].Y := (Theme.Song.Cover.Y + + (Theme.Song.Cover.H - Abs(Theme.Song.Cover.H * cos(Angle))) * 0.5); Button[B].W := Button[B].H; @@ -1777,7 +1723,7 @@ begin end else - begin {Behind the Front Covers} + begin //Behind the Front Covers // Button[B].Visible := False; // if VS/2-abs(Pos)>VS*0.4 then Button[B].Visible := False; @@ -1799,7 +1745,7 @@ begin // Button[B].Reflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; - Diff := (Button[B].H - Theme.Song.Cover.H)/2; + //Diff := (Button[B].H - Theme.Song.Cover.H)/2; Button[B].X := Theme.Song.Cover.X+Theme.Song.Cover.H/2-Button[b].H/2 + (Theme.Song.Cover.H)*sin(Angle/2)*1.52; @@ -1810,8 +1756,95 @@ begin end; end; +end; } + +//new version from 1.1 (copy) +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 + { 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..-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 - 2 + ceil(VS/2))/8 - 0.75 + else + Pos := (Pos + 2 - floor(VS/2))/8 + 0.75; + + // 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 + { all other covers are not visible } + else + Button[B].Visible := false; + end; + end; end; + procedure TScreenSong.onShow; var I: Integer; @@ -2381,7 +2414,6 @@ end; procedure TScreenSong.DrawAspect(); var - txt: PChar; w, h: real; str: string; @@ -2408,21 +2440,20 @@ begin glColor4f(1, 1, 1, 1); - h := 11*ScreenH/RenderH; + h := 12; SetFontStyle(1); SetFontItalic(false); SetFontSize(h); w := glTextWidth(PChar(str)); - SetFontPos (RenderW/2-w/2, 20); - txt := Addr(str[1]); - glPrint(txt); + SetFontPos (RenderW/2-w/2, 21); + glPrint(PChar(str)); end; procedure TScreenSong.SelectNext; var Skip, Skip2: integer; - I: integer; + //I: integer; VS: Integer; begin VS := CatSongs.VisibleSongs; @@ -2524,18 +2555,8 @@ begin end; end; -procedure TScreenSong.UpdateLCD; -begin{ - LCD.HideCursor; - LCD.Clear; - LCD.WriteText(1, Text[TextArtist].Text); - LCD.WriteText(2, Text[TextTitle].Text); } -end; - //Procedure Change current played Preview procedure TScreenSong.ChangeMusic; -var - I: integer; begin //When Music Preview is avtivated -> then Change Music if (Ini.PreviewVolume <> 0) then @@ -2543,6 +2564,7 @@ begin if (NOT CatSongs.Song[Interaction].Main) AND(CatSongs.VisibleSongs > 0) then begin Music.Close; + acClose; if Music.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3) then begin if (CatSongs.Song[Interaction].PreviewStart>0) then @@ -2671,7 +2693,7 @@ begin FixSelected2; end; -procedure TScreenSong.SkipTo2(Target: Cardinal); //new +procedure TScreenSong.SkipTo2(Target: Integer); //new begin UnLoadDetailedCover; @@ -3002,7 +3024,6 @@ begin Music.PlayChange; ChangeMusic; SetScroll; - UpdateLCD; end; //do Joker in M2-MOD mode @@ -3033,9 +3054,6 @@ begin end; procedure TScreenSong.SetJoker; -var - h, x, y: real; - ptxt: pchar; begin //If Party Mode if Mode = smParty then //Show Joker that are available @@ -3363,14 +3381,94 @@ begin Texture.UnloadTexture(Button[Interaction].Texture.Name, false); end; -procedure TScreenSong.Refresh; -begin { -CatSongs.Refresh; -CatSongs.ShowCategoryList; -Interaction := 0; -SelectNext; -FixSelected; } +procedure TScreenSong.Refresh(GiveStats: boolean); +var + Pet: integer; + I: integer; +Label CreateSongButtons; + +begin + ClearButtons(); + CatSongs.Refresh; + + if (length(CatSongs.Song) > 0) then + begin + //Set Length of Button Array one Time Instead of one time for every Song + SetButtonLength(Length(CatSongs.Song)); + + I := 0; + Pet := 0; + CreateSongButtons: + + try + for Pet := I to High(CatSongs.Song) do + begin // creating all buttons + // new + Texture.Limit := 512;// 256 0.4.2 value, 512 in 0.5.0 + + if not FileExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then + CatSongs.Song[Pet].Cover := ''; // 0.5.0: if cover not found then show 'no cover' + + if CatSongs.Song[Pet].Cover = '' then + AddButton(300 + Pet*250, 140, 200, 200, Skin.GetTextureFileName('SongCover'), 'JPG', 'Plain', Theme.Song.Cover.Reflections) + else begin + // cache texture if there is a need to this + if not Covers.CoverExists(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover) then begin + Texture.CreateCacheMipmap := true; + Texture.GetTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'Plain', true); // preloads textures and creates cache mipmap + Texture.CreateCacheMipmap := false; + + // puts this texture to the cache file + Covers.AddCover(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover); + + // unload full size texture + Texture.UnloadTexture(CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, false); + + // we should also add mipmap texture by calling createtexture and use mipmap cache as data source + end; + + // and now load it from cache file (small place for the optimization by eliminating reading it from file, but not here) + AddButton(300 + Pet*250, 140, 200, 200, CatSongs.Song[Pet].Path + CatSongs.Song[Pet].Cover, 'JPG', 'Plain', Theme.Song.Cover.Reflections); + end; + Texture.Limit := 1024*1024; + I := -1; + if GiveStats then + begin + if (Pet mod 10 = 0) then + UpdateScreenLoading('Songs: '+IntToStr(Pet)); + end; + + end; + except + //When Error is reported the First time for this Song + if (I <> Pet) then + begin + //Some Error reporting: + Log.LogError('Could not load Cover: ' + CatSongs.Song[Pet].Cover); + + //Change Cover to NoCover and Continue Loading + CatSongs.Song[Pet].Cover := ''; + I := Pet; + end + else //when Error occurs Multiple Times(NoSong Cover is damaged), then start loading next Song + begin + Log.LogError('NoCover Cover is damaged!'); + try + AddButton(300 + Pet*250, 140, 200, 200, '', 'JPG', 'Plain', Theme.Song.Cover.Reflections); + except + Messagebox(0, PChar('No Cover Image is damage. Could not Workaround Song Loading, Ultrastar will exit now.'), PChar(Language.Translate('US_VERSION')), MB_ICONERROR or MB_OK); + Halt; + end; + I := Pet + 1; + end; + end; + + if (I <> -1) then + GoTo CreateSongButtons; + + end; + FixSelected; end; function TScreenSong.getVisibleMedleyArr(MinS: TMedleySource): TVisArr; diff --git a/Game/Code/Screens/UScreenSongJumpto.pas b/Game/Code/Screens/UScreenSongJumpto.pas index e1a24ddf..ed86757b 100644 --- a/Game/Code/Screens/UScreenSongJumpto.pas +++ b/Game/Code/Screens/UScreenSongJumpto.pas @@ -104,6 +104,11 @@ begin CatSongs.SetFilter('', 0); SetTextFound(0); end; + if(ScreenSong.Mode = smNormal) and not ScreenSong.MakeMedley then + begin + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; + end; end; // Up and Down could be done at the same time, @@ -142,8 +147,8 @@ begin end; constructor TScreenSongJumpto.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas index ccf14978..ccd9d07c 100644 --- a/Game/Code/Screens/UScreenSongMenu.pas +++ b/Game/Code/Screens/UScreenSongMenu.pas @@ -134,6 +134,12 @@ begin begin Music.PlayBack; Visible := False; + if(ScreenSong.Mode = smNormal) and not ScreenSong.MakeMedley then + begin + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; + end; + CatSongs.Selected := Interaction; end; SDLK_RETURN: @@ -192,8 +198,8 @@ begin end; constructor TScreenSongMenu.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; @@ -540,6 +546,8 @@ begin 4: //Button 4 begin PlaylistMan.AddItem(ScreenSong.Interaction, SelectValue); + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; end; @@ -559,6 +567,8 @@ begin PlaylistMan.AddItem( ScreenSong.Interaction, PlaylistMan.AddPlaylist(Button[0].Text[0].Text)); + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; @@ -570,6 +580,8 @@ begin 4: //Button 4 begin + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; end; @@ -583,6 +595,8 @@ begin begin //Delete PlayListMan.DelItem(PlayListMan.GetIndexbySongID(ScreenSong.Interaction)); + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; @@ -604,6 +618,8 @@ begin begin //Load Playlist PlaylistMan.SetPlayList(SelectValue); + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; end; @@ -617,6 +633,8 @@ begin begin //Delete PlayListMan.DelPlaylist(PlaylistMan.CurPlayList); + ScreenSong.WaitHandler.changed := true; + ScreenSong.WaitHandler.change_time := 0; Visible := False; end; diff --git a/Game/Code/Screens/UScreenStatMain.pas b/Game/Code/Screens/UScreenStatMain.pas index b82e655c..68eac441 100644 --- a/Game/Code/Screens/UScreenStatMain.pas +++ b/Game/Code/Screens/UScreenStatMain.pas @@ -84,8 +84,8 @@ begin end; constructor TScreenStatMain.Create; -var - I: integer; +{var + I: integer;} begin inherited Create; @@ -114,16 +114,19 @@ begin AddButtonText(14, 20, Theme.Options.Description[4]); Interaction := 0; +end; +procedure TScreenStatMain.onShow; +var + I: Integer; + +begin //Set Songs with Vid SongswithVid := 0; For I := 0 to high(Songs.Song) do if (Songs.Song[I].Video <> '') then Inc(SongswithVid); -end; -procedure TScreenStatMain.onShow; -begin //Set Overview Text: SetOverview; if not Help.SetHelpID(ID) then @@ -133,7 +136,7 @@ end; procedure TScreenStatMain.SetOverview; var Overview, Formatstr: String; - I: Integer; + //I: Integer; //Some Vars to Save Attributes to A1, A2, A3: Integer; A4, A5: String; diff --git a/Game/Code/Screens/UScreenTop.pas b/Game/Code/Screens/UScreenTop.pas index 57005d95..e2e36d64 100644 --- a/Game/Code/Screens/UScreenTop.pas +++ b/Game/Code/Screens/UScreenTop.pas @@ -3,7 +3,7 @@ unit UScreenTop; interface uses - UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ULCD, ModiSDK; + UMenu, SDL, SysUtils, UDisplay, UMusic, USongs, UThemes, ModiSDK; type THandler = record @@ -250,4 +250,4 @@ begin MP3VolumeHandler.changed := false; end; -end. +end. \ No newline at end of file diff --git a/Game/Code/UltraStar.bdsproj b/Game/Code/UltraStar.bdsproj index 06215810..64cad021 100644 --- a/Game/Code/UltraStar.bdsproj +++ b/Game/Code/UltraStar.bdsproj @@ -18,8 +18,8 @@ 8 0 - 1 - 1 + 0 + 0 0 0 1 @@ -27,7 +27,7 @@ 1 0 0 - 1 + 0 0 1 1 @@ -38,9 +38,9 @@ 0 1 1 - 0 + 1 1 - 1 + 0 1 True True @@ -124,7 +124,7 @@ lib\JEDI-SDLv1.0\SDL\Pas - + vclx;vcl;rtl;dbrtl;vcldb;adortl;dbxcds;dbexpress;xmlrtl;vclie;inet;inetdbbde;inetdbxpress;dclOfficeXP;soaprtl;dsnap;vclactnband;bdertl;vcldbx False @@ -136,7 +136,7 @@ False - True + False False @@ -170,6 +170,13 @@ 1.0.0.0 - - + + Borland InterBase Express Components + Intraweb 8.0 Design Package for Borland Development Studio 2006 + Indy 10 Core Design Time + Borland Sample Components + Indy 10 Protocols Design Time + TeeChart-Komponenten + + diff --git a/Game/Code/UltraStar.cfg b/Game/Code/UltraStar.cfg index c99ab319..7e2ddcc4 100644 --- a/Game/Code/UltraStar.cfg +++ b/Game/Code/UltraStar.cfg @@ -1,7 +1,7 @@ -$A8 -$B- --$C+ --$D+ +-$C- +-$D- -$E- -$F- -$G+ @@ -9,7 +9,7 @@ -$I+ -$J- -$K- --$L+ +-$L- -$M- -$N+ -$O+ @@ -20,9 +20,9 @@ -$T- -$U+ -$V+ --$W- +-$W+ -$X+ --$YD +-$Y- -$Z1 -cg -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr index d822cdb1..7cc5cfd8 100644 --- a/Game/Code/UltraStar.dpr +++ b/Game/Code/UltraStar.dpr @@ -13,7 +13,7 @@ uses glu in 'lib\JEDI-SDLv1.0\OpenGL\Pas\glu.pas', glext in 'lib\JEDI-SDLv1.0\OpenGL\Pas\glext.pas', sdl_ttf in 'lib\JEDI-SDLv1.0\SDL_ttf\Pas\sdl_ttf.pas', - smpeg in 'lib\JEDI-SDLv1.0\smpeg\Pas\smpeg.pas', + //smpeg in 'lib\JEDI-SDLv1.0\smpeg\Pas\smpeg.pas', bass in 'lib\bass\delphi\bass.pas', PNGImage in 'lib\PNGImage\PNGImage.pas', PNGzLib in 'lib\PNGImage\PNGzLib.pas', @@ -52,14 +52,14 @@ uses USongs in 'Classes\USongs.pas', UIni in 'Classes\UIni.pas', UHelp in 'Classes\UHelp.pas', - USmpeg in 'SMpeg\USmpeg.pas', + //USmpeg in 'SMpeg\USmpeg.pas', ULyrics in 'Classes\ULyrics.pas', USkins in 'Classes\USkins.pas', UThemes in 'Classes\UThemes.pas', ULog in 'Classes\ULog.pas', UJoystick in 'Classes\UJoystick.pas', - ULCD in 'Classes\ULCD.pas', - ULight in 'Classes\ULight.pas', + //ULCD in 'Classes\ULCD.pas', + //ULight in 'Classes\ULight.pas', UDataBase in 'Classes\UDataBase.pas', UCovers in 'Classes\UCovers.pas', UCatCovers in 'Classes\UCatCovers.pas', @@ -124,7 +124,7 @@ uses acinerella in 'lib\acinerella\acinerella.pas'; const - Version = 'UltraStar Deluxe v1.0.1a Challenge-MOD r7b beta 7 2010-04-09'; + Version = 'UltraStar Deluxe v1.0.1a Challenge-Mod r7b RC2 2010-04-28'; var WndTitle: string; @@ -222,28 +222,6 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Ini', 1); - // LCD - Log.BenchmarkStart(1); - Log.LogStatus('Load LCD', 'Initialization'); LCD := TLCD.Create; - if Ini.LPT = 1 then begin -// LCD.HalfInterface := true; - LCD.Enable; - LCD.Clear; - LCD.WriteText(1, ' UltraStar '); - LCD.WriteText(2, ' Loading... '); - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading LCD', 1); - - // Light - Log.BenchmarkStart(1); - Log.LogStatus('Load Light', 'Initialization'); Light := TLight.Create; - if Ini.LPT = 2 then begin - Light.Enable; - end; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Light', 1); - // Theme Log.BenchmarkStart(1); Log.LogStatus('Load Themes', 'Initialization'); Theme := TTheme.Create('Themes\' + ITheme[Ini.Theme] + '.ini', Ini.Color); @@ -263,14 +241,6 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading Category Covers Array', 1); - // Songs - //Log.BenchmarkStart(1); - Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; - Songs.LoadSongList; - Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; - Log.BenchmarkEnd(1); - Log.LogBenchmark('Loading Songs', 1); - // PluginManager Log.BenchmarkStart(1); Log.LogStatus('PluginManager', 'Initialization'); @@ -298,6 +268,17 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Initializing 3D', 1); + // Songs + //Log.BenchmarkStart(1); + Log.LogStatus('Creating Song Array', 'Initialization'); Songs := TSongs.Create; + Songs.LoadSongList; + Log.LogStatus('Creating 2nd Song Array', 'Initialization'); CatSongs := TCatSongs.Create; + Log.BenchmarkEnd(1); + Log.LogBenchmark('Loading Songs', 1); + + // Refresh ScreenSong + ScreenSong.Refresh(true); + // Sound Log.BenchmarkStart(1); Log.LogStatus('Initialize Sound', 'Initialization'); @@ -357,8 +338,8 @@ begin //------------------------------ //Finish Application //------------------------------ - if Ini.LPT = 1 then LCD.Clear; - if Ini.LPT = 2 then Light.TurnOff; + //if Ini.LPT = 1 then LCD.Clear; + //if Ini.LPT = 2 then Light.TurnOff; Log.Free; -end. +end. \ No newline at end of file diff --git a/Game/Code/lib/SQLite/SQLiteTable3.pas b/Game/Code/lib/SQLite/SQLiteTable3.pas index 9f2b86b3..4cbcf5c0 100644 --- a/Game/Code/lib/SQLite/SQLiteTable3.pas +++ b/Game/Code/lib/SQLite/SQLiteTable3.pas @@ -380,7 +380,7 @@ function TSQLiteDatabase.ContainsColumn(Table: String; Column: String) : boolean var sql: string; ds: TSqliteTable; - i : integer; + begin sql := 'PRAGMA TABLE_INFO('+Table+');'; ds := self.GetTable(sql); @@ -802,4 +802,3 @@ end; end. - diff --git a/Game/Code/lib/midi/MidiFile.pas b/Game/Code/lib/midi/MidiFile.pas index 10b64a80..0a848eda 100644 --- a/Game/Code/lib/midi/MidiFile.pas +++ b/Game/Code/lib/midi/MidiFile.pas @@ -183,8 +183,8 @@ type // playing attributes playing: boolean; - PlayStartTime: integer; - currentTime: integer; // Current playtime in msec + PlayStartTime: Cardinal; + currentTime: Cardinal; // Current playtime in msec currentPos: Double; // Current Position in ticks procedure OnTrackReady; @@ -210,9 +210,9 @@ type procedure StopPlaying; procedure ContinuePlaying; - procedure PlayToTime(time: integer); - procedure GoToTime(time: integer); - function GetCurrentTime: integer; + procedure PlayToTime(time: Cardinal); + procedure GoToTime(time: Cardinal); + function GetCurrentTime: Cardinal; function GetFusPerTick : Double; function GetTrackLength:integer; function Ready: boolean; @@ -424,7 +424,7 @@ end; constructor TMidifile.Create(AOwner: TComponent); begin inherited Create(AOWner); - MIDIFileHandle:=AllocateHWnd(WndProc); + MIDIFileHandle:=Classes.AllocateHWnd(WndProc); chunkData := nil; chunkType := illegal; Tracks := TList.Create; @@ -444,7 +444,7 @@ begin if MIDITimerID<>0 then KillMIDITimer; - DeallocateHWnd(MIDIFileHandle); + Classes.DeallocateHWnd(MIDIFileHandle); inherited Destroy; end; @@ -514,17 +514,17 @@ begin SetPriorityClass(MIDIFileHandle,FPriority); end; -function TMidiFile.GetCurrentTime: integer; +function TMidiFile.GetCurrentTime: Cardinal; begin Result := currentTime; end; -procedure TMidifile.PlayToTime(time: integer); +procedure TMidifile.PlayToTime(time: Cardinal); var i: integer; - track: TMidiTrack; pos: integer; deltaTime: integer; + begin // calculate the pos in the file. // pos is actually tick @@ -541,11 +541,11 @@ begin currentTime := time; end; -procedure TMidifile.GoToTime(time: integer); +procedure TMidifile.GoToTime(time: Cardinal); var i: integer; - track: TMidiTrack; pos: integer; + begin // this function should be changed because FusPerTick might not be constant pos := round((time * 1000) / FusPerTick); @@ -639,10 +639,9 @@ var dTime: integer; event: integer; len: integer; - str: string; midiEvent: PMidiEvent; - i: integer; us_per_quarter: integer; + begin chunkIndex := chunkData; // inc(chunkIndex); @@ -953,4 +952,3 @@ begin end; end. - diff --git a/Game/Code/lib/midi/Midiin.pas b/Game/Code/lib/midi/Midiin.pas index 32a17c51..2ed8d619 100644 --- a/Game/Code/lib/midi/Midiin.pas +++ b/Game/Code/lib/midi/Midiin.pas @@ -102,7 +102,8 @@ unit MidiIn; interface uses - Classes, SysUtils, WinTypes, Messages, WinProcs, MMSystem, MidiDefs, MidiType, + Classes, SysUtils, WinTypes, Messages, WinProcs, MMSystem, + MidiDefs, MidiType, MidiCons, Circbuf, Delphmcb; type @@ -259,7 +260,7 @@ begin { Create the window for callback notification } if not (csDesigning in ComponentState) then begin - Handle := AllocateHwnd(MidiInput); + Handle := Classes.AllocateHwnd(MidiInput); end; FState := misClosed; @@ -280,7 +281,7 @@ begin if (PCtlInfo <> nil) then GlobalSharedLockedFree(PCtlinfo^.hMem, PCtlInfo); - DeallocateHwnd(Handle); + Classes.DeallocateHwnd(Handle); inherited Destroy; end; diff --git a/Game/Code/lib/midi/Midiout.pas b/Game/Code/lib/midi/Midiout.pas index 91b75073..ba5f7697 100644 --- a/Game/Code/lib/midi/Midiout.pas +++ b/Game/Code/lib/midi/Midiout.pas @@ -126,7 +126,7 @@ type TMidiOutput = class(TComponent) protected Handle: THandle; { Window handle used for callback notification } - FDeviceID: Integer; { MIDI device ID } + FDeviceID: Cardinal; { MIDI device ID } FMIDIHandle: Hmidiout; { Handle to output device } FState: midioutputState; { Current device state } PCtlInfo: PMidiCtlInfo; { Pointer to control info for DLL } @@ -151,7 +151,7 @@ type FOnMIDIOutput: TNotifyEvent; { Sysex output finished } procedure MidiOutput(var Message: TMessage); - procedure SetDeviceID(DeviceID: Integer); + procedure SetDeviceID(DeviceID: Cardinal); procedure SetProductName(NewProductName: string); procedure SetTechnology(NewTechnology: OutPortTech); function midioutErrorString(WError: Word): string; @@ -192,7 +192,7 @@ type { TODO: Property editor with dropdown list of product names } property ProductName: string read FProductName write SetProductName; - property DeviceID: Integer read FDeviceID write SetDeviceID default 0; + property DeviceID: Cardinal read FDeviceID write SetDeviceID default 0; { TODO: midiOutGetVolume? Or two properties for Left and Right volume? Is it worth it?? midiOutMessage?? Does anyone use this? } @@ -243,7 +243,7 @@ begin { Create the window for callback notification } if not (csDesigning in ComponentState) then begin - Handle := AllocateHwnd(MidiOutput); + Handle := Classes.AllocateHwnd(MidiOutput); end; end; @@ -256,7 +256,7 @@ begin Close; if (PCtlInfo <> nil) then GlobalSharedLockedFree(PCtlinfo^.hMem, PCtlInfo); - DeallocateHwnd(Handle); + Classes.DeallocateHwnd(Handle); inherited Destroy; end; @@ -286,7 +286,7 @@ end; {-------------------------------------------------------------------} { Set the output device ID and change the other properties to match } -procedure Tmidioutput.SetDeviceID(DeviceID: Integer); +procedure Tmidioutput.SetDeviceID(DeviceID: Cardinal); var midioutCaps: TmidioutCaps; begin -- cgit v1.2.3