diff options
Diffstat (limited to 'unicode/src')
77 files changed, 3937 insertions, 5784 deletions
diff --git a/unicode/src/base/UBeatTimer.pas b/unicode/src/base/UBeatTimer.pas deleted file mode 100644 index a47a06f9..00000000 --- a/unicode/src/base/UBeatTimer.pas +++ /dev/null @@ -1,170 +0,0 @@ - {* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL: https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/trunk/src/base/USingNotes.pas $
- * $Id: USingNotes.pas 1406 2008-09-23 21:43:52Z k-m_schindler $
- *}
-
-unit UBeatTimer;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- UTime;
-
-type
- (**
- * TLyricsState contains all information concerning the
- * state of the lyrics, e.g. the current beat or duration of the lyrics.
- *)
- TLyricsState = class
- private
- Timer: TRelativeTimer; // keeps track of the current time
- public
- OldBeat: integer; // previous discovered beat
- CurrentBeat: integer; // current beat (rounded)
- MidBeat: real; // current beat (float)
-
- // now we use this for super synchronization!
- // only used when analyzing voice
- // TODO: change ...D to ...Detect(ed)
- OldBeatD: integer; // previous discovered beat
- CurrentBeatD: integer; // current discovered beat (rounded)
- MidBeatD: real; // current discovered beat (float)
-
- // we use this for audible clicks
- // TODO: Change ...C to ...Click
- OldBeatC: integer; // previous discovered beat
- CurrentBeatC: integer;
- MidBeatC: real; // like CurrentBeatC
-
- OldLine: integer; // previous displayed sentence
-
- StartTime: real; // time till start of lyrics (= Gap)
- TotalTime: real; // total song time
-
- constructor Create();
- procedure Pause();
- procedure Resume();
-
- procedure Reset();
- procedure UpdateBeats();
-
- (**
- * current song time (in seconds) used as base-timer for lyrics etc.
- *)
- function GetCurrentTime(): real;
- procedure SetCurrentTime(Time: real);
- end;
-
-implementation
-uses UNote, Math;
-
-
-constructor TLyricsState.Create();
-begin
- // create a triggered timer, so we can Pause() it, set the time
- // and Resume() it afterwards for better synching.
- Timer := TRelativeTimer.Create(true);
-
- // reset state
- Reset();
-end;
-
-procedure TLyricsState.Pause();
-begin
- Timer.Pause();
-end;
-
-procedure TLyricsState.Resume();
-begin
- Timer.Resume();
-end;
-
-procedure TLyricsState.SetCurrentTime(Time: real);
-begin
- // do not start the timer (if not started already),
- // after setting the current time
- Timer.SetTime(Time, false);
-end;
-
-function TLyricsState.GetCurrentTime(): real;
-begin
- Result := Timer.GetTime();
-end;
-
-(**
- * Resets the timer and state of the lyrics.
- * The timer will be stopped afterwards so you have to call Resume()
- * to start the lyrics timer.
- *)
-procedure TLyricsState.Reset();
-begin
- Pause();
- SetCurrentTime(0);
-
- StartTime := 0;
- TotalTime := 0;
-
- OldBeat := -1;
- MidBeat := -1;
- CurrentBeat := -1;
-
- OldBeatC := -1;
- MidBeatC := -1;
- CurrentBeatC := -1;
-
- OldBeatD := -1;
- MidBeatD := -1;
- CurrentBeatD := -1;
-end;
-
-(**
- * Updates the beat information (CurrentBeat/MidBeat/...) according to the
- * current lyric time.
- *)
-procedure TLyricsState.UpdateBeats();
-var
- CurLyricsTime: real;
-begin
- CurLyricsTime := GetCurrentTime();
-
- OldBeat := CurrentBeat;
- MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeat := Floor(MidBeat);
-
- OldBeatC := CurrentBeatC;
- MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeatC := Floor(MidBeatC);
-
- OldBeatD := CurrentBeatD;
- // MidBeatD = MidBeat with additional GAP
- MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000);
- CurrentBeatD := Floor(MidBeatD);
-end;
-
-end.
\ No newline at end of file diff --git a/unicode/src/base/UCommon.pas b/unicode/src/base/UCommon.pas index 3230a065..f5697916 100644 --- a/unicode/src/base/UCommon.pas +++ b/unicode/src/base/UCommon.pas @@ -44,16 +44,16 @@ uses ULog; type - TMessageType = (mtInfo, mtError); + TMessageType = ( mtInfo, mtError ); -procedure ShowMessage(const msg: string; msgType: TMessageType = mtInfo); +procedure ShowMessage(const msg : String; msgType: TMessageType = mtInfo); procedure ConsoleWriteLn(const msg: string); function RWopsFromStream(Stream: TStream): PSDL_RWops; {$IFDEF FPC} -function RandomRange(aMin: integer; aMax: integer): integer; +function RandomRange(aMin: Integer; aMax: Integer): Integer; {$ENDIF} procedure DisableFloatingPointExceptions(); @@ -61,8 +61,8 @@ procedure SetDefaultNumericLocale(); procedure RestoreNumericLocale(); {$IFNDEF MSWINDOWS} - procedure ZeroMemory(Destination: pointer; Length: dword); - function MakeLong(a, b: word): longint; + procedure ZeroMemory(Destination: Pointer; Length: DWORD); + function MakeLong(a, b: Word): Longint; {$ENDIF} function AdaptFilePaths(const aPath: widestring): widestring; @@ -71,8 +71,8 @@ function FileExistsInsensitive(var FileName: string): boolean; // A stable alternative to TList.Sort() (use TList.Sort() if applicable, see below) procedure MergeSort(List: TList; CompareFunc: TListSortCompare); -function GetAlignedMem(Size: cardinal; Alignment: integer): pointer; -procedure FreeAlignedMem(P: pointer); +function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer; +procedure FreeAlignedMem(P: Pointer); implementation @@ -206,19 +206,20 @@ begin exOverflow, exUnderflow, exPrecision]); end; -function AdaptFilePaths(const aPath: WideString): WideString; +function AdaptFilePaths( const aPath : widestring ): widestring; begin - result := StringReplaceW(aPath, '\', PathDelim);//, [rfReplaceAll]); + result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] ); end; {$IFNDEF MSWINDOWS} -procedure ZeroMemory(Destination: pointer; Length: dword); + +procedure ZeroMemory( Destination: Pointer; Length: DWORD ); begin - FillChar(Destination^, Length, 0); + FillChar( Destination^, Length, 0 ); end; -function MakeLong(A, B: word): longint; +function MakeLong(A, B: Word): Longint; begin Result := (LongInt(B) shl 16) + A; end; @@ -243,7 +244,7 @@ begin Result := false; FilePath := ExtractFilePath(FileName); - if (FindFirst(FilePath + '*', faAnyFile, SearchInfo) = 0) then + if (FindFirst(FilePath+'*', faAnyFile, SearchInfo) = 0) then begin LocalFileName := ExtractFileName(FileName); repeat @@ -263,14 +264,14 @@ begin end; // +++++++++++++++++++++ helpers for RWOpsFromStream() +++++++++++++++ -function SdlStreamSeek(context: PSDL_RWops; offset: integer; whence: integer): integer; cdecl; +function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl; var - stream: TStream; - origin: word; + stream : TStream; + origin : Word; begin - stream := TStream(context.unknown); - if (stream = nil) then - raise EInvalidContainer.Create('SDLStreamSeek on nil'); + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamSeek on nil' ); case whence of 0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0. 1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset. @@ -278,30 +279,30 @@ begin else origin := soFromBeginning; // just in case end; - Result := stream.Seek(offset, origin); + Result := stream.Seek( offset, origin ); end; -function SdlStreamRead(context: PSDL_RWops; Ptr: pointer; size: integer; maxnum: integer): integer; cdecl; +function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl; var - stream: TStream; + stream : TStream; begin - stream := TStream(context.unknown); - if (stream = nil) then - raise EInvalidContainer.Create('SDLStreamRead on nil'); + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamRead on nil' ); try - Result := stream.read(Ptr^, Size * maxnum) div size; + Result := stream.read( Ptr^, Size * maxnum ) div size; except Result := -1; end; end; -function SDLStreamClose(context: PSDL_RWops): integer; cdecl; +function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl; var - stream: TStream; + stream : TStream; begin - stream := TStream(context.unknown); - if (stream = nil) then - raise EInvalidContainer.Create('SDLStreamClose on nil'); + stream := TStream( context.unknown ); + if ( stream = nil ) then + raise EInvalidContainer.Create( 'SDLStreamClose on nil' ); stream.Free; Result := 1; end; @@ -330,10 +331,12 @@ begin end; end; + + {$IFDEF FPC} -function RandomRange(aMin: integer; aMax: integer): integer; +function RandomRange(aMin: Integer; aMax: Integer) : Integer; begin - RandomRange := Random(aMax - aMin) + aMin ; + RandomRange := Random(aMax-aMin) + aMin ; end; {$ENDIF} @@ -386,7 +389,7 @@ begin System.EnterCriticalSection(ConsoleCriticalSection); // output pending messages - for i := 0 to MessageList.Count - 1 do + for i := 0 to MessageList.Count-1 do begin _ConsoleWriteLn(MessageList[i]); end; @@ -459,7 +462,7 @@ end; procedure ShowMessage(const msg: String; msgType: TMessageType); {$IFDEF MSWINDOWS} -var Flags: cardinal; +var Flags: Cardinal; {$ENDIF} begin {$IF Defined(MSWINDOWS)} @@ -485,7 +488,7 @@ procedure _MergeSort(InList, TempList, OutList: TList; StartPos, BlockSize: inte CompareFunc: TListSortCompare); var LeftSize, RightSize: integer; // number of elements in left/right block - LeftEnd, RightEnd: integer; // Index after last element in left/right block + LeftEnd, RightEnd: integer; // Index after last element in left/right block MidPos: integer; // index of first element in right block Pos: integer; // position in output list begin @@ -561,7 +564,7 @@ end; type // stores the unaligned pointer of data allocated by GetAlignedMem() PMemAlignHeader = ^TMemAlignHeader; - TMemAlignHeader = pointer; + TMemAlignHeader = Pointer; (** * Use this function to assure that allocated memory is aligned on a specific @@ -577,9 +580,9 @@ type * alignments on 16 and 32 byte boundaries too. *) {$WARNINGS OFF} -function GetAlignedMem(Size: cardinal; Alignment: integer): pointer; +function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer; var - OrigPtr: pointer; + OrigPtr: Pointer; const MIN_ALIGNMENT = 16; begin @@ -600,9 +603,9 @@ begin end; // reserve space for the header - Result := pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader)); + Result := Pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader)); // align memory - Result := pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment); + Result := Pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment); // set header with info on old pointer for FreeMem PMemAlignHeader(PtrUInt(Result) - SizeOf(TMemAlignHeader))^ := OrigPtr; @@ -610,7 +613,7 @@ end; {$WARNINGS ON} {$WARNINGS OFF} -procedure FreeAlignedMem(P: pointer); +procedure FreeAlignedMem(P: Pointer); begin if (P <> nil) then FreeMem(PMemAlignHeader(PtrUInt(P) - SizeOf(TMemAlignHeader))^); diff --git a/unicode/src/base/UConfig.pas b/unicode/src/base/UConfig.pas index 1214f36f..cb663e2d 100644 --- a/unicode/src/base/UConfig.pas +++ b/unicode/src/base/UConfig.pas @@ -107,7 +107,7 @@ const // include config-file (defines + constants) {$IF Defined(MSWindows)} - {$I ..\config-win.inc} + {$I ../config-win.inc} {$ELSEIF Defined(Linux)} {$I ../config-linux.inc} {$ELSEIF Defined(FreeBSD)} diff --git a/unicode/src/base/UDLLManager.pas b/unicode/src/base/UDLLManager.pas index 3faa15bf..cd4b7991 100644 --- a/unicode/src/base/UDLLManager.pas +++ b/unicode/src/base/UDLLManager.pas @@ -40,42 +40,37 @@ uses type TDLLMan = class private - hLib: THandle; + hLib: THandle; P_Init: fModi_Init; P_Draw: fModi_Draw; P_Finish: fModi_Finish; P_RData: pModi_RData; public Plugins: array of TPluginInfo; - PluginPaths: array of string; + PluginPaths: array of String; Selected: ^TPluginInfo; constructor Create; procedure GetPluginList; - procedure ClearPluginInfo(No: cardinal); - function LoadPluginInfo(Filename: string; No: cardinal): boolean; + procedure ClearPluginInfo(No: Cardinal); + function LoadPluginInfo(Filename: String; No: Cardinal): boolean; - function LoadPlugin(No: cardinal): boolean; + function LoadPlugin(No: Cardinal): boolean; procedure UnLoadPlugin; - function PluginInit (const TeamInfo: TTeamInfo; - var Playerinfo: TPlayerinfo; - const Sentences: TSentences; - const LoadTex: fModi_LoadTex; - const Print: fModi_Print; - LoadSound: fModi_LoadSound; - PlaySound: pModi_PlaySound) - : boolean; - function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean; + function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; + function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; function PluginFinish (var Playerinfo: TPlayerinfo): byte; - procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: dword; user: dword); + procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); end; var DLLMan: TDLLMan; const + DLLPath = 'Plugins'; + {$IF Defined(MSWINDOWS)} DLLExt = '.dll'; {$ELSEIF Defined(DARWIN)} @@ -92,7 +87,6 @@ uses {$ELSE} dynlibs, {$ENDIF} - UPath, ULog, SysUtils; @@ -107,33 +101,33 @@ end; procedure TDLLMan.GetPluginList; var - SearchRecord: TSearchRec; + SR: TSearchRec; begin - if FindFirst(PluginPath + '*' + DLLExt, faAnyFile, SearchRecord) = 0 then + if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then begin repeat SetLength(Plugins, Length(Plugins)+1); SetLength(PluginPaths, Length(Plugins)); - if LoadPluginInfo(SearchRecord.Name, High(Plugins)) then // loaded succesful + if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful begin - PluginPaths[High(PluginPaths)] := SearchRecord.Name; + PluginPaths[High(PluginPaths)] := SR.Name; end - else // error loading + else //Error Loading begin SetLength(Plugins, Length(Plugins)-1); SetLength(PluginPaths, Length(Plugins)); end; - until FindNext(SearchRecord) <> 0; - FindClose(SearchRecord); + until FindNext(SR) <> 0; + FindClose(SR); end; end; -procedure TDLLMan.ClearPluginInfo(No: cardinal); +procedure TDLLMan.ClearPluginInfo(No: Cardinal); begin -// set to party modi plugin + //Set to Party Modi Plugin Plugins[No].Typ := 8; Plugins[No].Name := 'unknown'; @@ -142,117 +136,109 @@ begin Plugins[No].Creator := 'Nobody'; Plugins[No].PluginDesc := 'NO_PLUGIN_DESC'; - Plugins[No].LoadSong := true; - Plugins[No].ShowScore := true; - Plugins[No].ShowBars := true; - Plugins[No].ShowNotes := true; - Plugins[No].LoadVideo := true; - Plugins[No].LoadBack := true; + Plugins[No].LoadSong := True; + Plugins[No].ShowScore := True; + Plugins[No].ShowBars := False; + Plugins[No].ShowNotes := True; + Plugins[No].LoadVideo := True; + Plugins[No].LoadBack := True; - Plugins[No].TeamModeOnly := true; - Plugins[No].GetSoundData := true; - Plugins[No].Dummy := true; + Plugins[No].TeamModeOnly := False; + Plugins[No].GetSoundData := False; + Plugins[No].Dummy := False; - Plugins[No].BGShowFull := true; - Plugins[No].BGShowFull_O := true; + Plugins[No].BGShowFull := False; + Plugins[No].BGShowFull_O := True; - Plugins[No].ShowRateBar := true; - Plugins[No].ShowRateBar_O := true; + Plugins[No].ShowRateBar:= False; + Plugins[No].ShowRateBar_O := True; - Plugins[No].EnLineBonus := true; - Plugins[No].EnLineBonus_O := true; + Plugins[No].EnLineBonus := False; + Plugins[No].EnLineBonus_O := True; end; -function TDLLMan.LoadPluginInfo(Filename: string; No: cardinal): boolean; +function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean; var hLibg: THandle; Info: pModi_PluginInfo; -// I: integer; + //I: Integer; begin - Result := true; -// clear plugin info + Result := False; + //Clear Plugin Info ClearPluginInfo(No); -{ -// workaround plugins loaded 2 times - for i := low(pluginpaths) to high(pluginpaths) do - if (pluginpaths[i] = filename) then - exit; -} + {//Workaround Plugins Loaded 2 Times + For I := low(PluginPaths) to high(PluginPaths) do + if (PluginPaths[I] = Filename) then + exit; } -// load libary - hLibg := LoadLibrary(PChar(PluginPath + Filename)); -// if loaded + //Load Libary + hLibg := LoadLibrary(PChar(DLLPath +PathDelim+ Filename)); + //If Loaded if (hLibg <> 0) then begin -// load info procedure - @Info := GetProcAddress(hLibg, PChar('PluginInfo')); + //Load Info Procedure + @Info := GetProcAddress (hLibg, PChar('PluginInfo')); -// if loaded + //If Loaded if (@Info <> nil) then begin -// load plugininfo - Info(Plugins[No]); - Result := true; + //Load PluginInfo + Info (Plugins[No]); + Result := True; end else - Log.LogError('Could not load plugin "' + Filename + '": Info procedure not found'); + Log.LogError('Could not Load Plugin "' + Filename + '": Info Procedure not Found'); FreeLibrary (hLibg); end - else - Log.LogError('Could not load plugin "' + Filename + '": Libary not loaded'); + else + Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded'); end; -function TDLLMan.LoadPlugin(No: cardinal): boolean; +function TDLLMan.LoadPlugin(No: Cardinal): boolean; begin - Result := true; -// load libary - hLib := LoadLibrary(PChar(PluginPath + PluginPaths[No])); -// if loaded + Result := False; + //Load Libary + hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No])); + //If Loaded if (hLib <> 0) then begin -// load info procedure - @P_Init := GetProcAddress (hLib, 'Init'); - @P_Draw := GetProcAddress (hLib, 'Draw'); - @P_Finish := GetProcAddress (hLib, 'Finish'); + //Load Info Procedure + @P_Init := GetProcAddress (hLib, PChar('Init')); + @P_Draw := GetProcAddress (hLib, PChar('Draw')); + @P_Finish := GetProcAddress (hLib, PChar('Finish')); -// if loaded - if (@P_Init <> nil) and (@P_Draw <> nil) and (@P_Finish <> nil) then + //If Loaded + if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then begin Selected := @Plugins[No]; - Result := true; + Result := True; end else begin - Log.LogError('Could not load plugin "' + PluginPaths[No] + '": Procedures not found'); + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Procedures not Found'); + end; end - else - Log.LogError('Could not load plugin "' + PluginPaths[No] + '": Libary not loaded'); + else + Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Libary not Loaded'); end; procedure TDLLMan.UnLoadPlugin; begin - if (hLib <> 0) then - FreeLibrary (hLib); - -// Selected := nil; - @P_Init := nil; - @P_Draw := nil; - @P_Finish := nil; - @P_RData := nil; +if (hLib <> 0) then + FreeLibrary (hLib); + +//Selected := nil; +@P_Init := nil; +@P_Draw := nil; +@P_Finish := nil; +@P_RData := nil; end; -function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; - var Playerinfo: TPlayerinfo; - const Sentences: TSentences; - const LoadTex: fModi_LoadTex; - const Print: fModi_Print; - LoadSound: fModi_LoadSound; - PlaySound: pModi_PlaySound) - : boolean; +function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean; var Methods: TMethodRec; begin @@ -264,26 +250,26 @@ begin if (@P_Init <> nil) then Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods) else - Result := true + Result := False end; -function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean; +function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean; begin - if (@P_Draw <> nil) then - Result := P_Draw (PlayerInfo, CurSentence) - else - Result := true +if (@P_Draw <> nil) then + Result := P_Draw (PlayerInfo, CurSentence) +else + Result := False end; function TDLLMan.PluginFinish (var Playerinfo: TPlayerinfo): byte; begin - if (@P_Finish <> nil) then - Result := P_Finish (PlayerInfo) - else - Result := 0; +if (@P_Finish <> nil) then + Result := P_Finish (PlayerInfo) +else + Result := 0; end; -procedure TDLLMan.PluginRData (handle: HStream; buffer: Pointer; len: dword; user: dword); +procedure TDLLMan.PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD); begin if (@P_RData <> nil) then P_RData (handle, buffer, len, user); diff --git a/unicode/src/base/UDraw.pas b/unicode/src/base/UDraw.pas index 1783986f..8a66d271 100644 --- a/unicode/src/base/UDraw.pas +++ b/unicode/src/base/UDraw.pas @@ -638,7 +638,7 @@ begin // determine lyric help bar position and size Bounds.Left := MoveStartX + BarProgress * MoveDist; Bounds.Right := Bounds.Left + BarWidth; - Bounds.Top := Theme.LyricBar.IndicatorYOffset + Theme.LyricBar.UpperY ; + Bounds.Top := Skin_LyricsT + 3; Bounds.Bottom := Bounds.Top + BarHeight + 3; // draw lyric help bar diff --git a/unicode/src/base/UEditorLyrics.pas b/unicode/src/base/UEditorLyrics.pas index ef9d8dd6..fe8c3ee5 100644 --- a/unicode/src/base/UEditorLyrics.pas +++ b/unicode/src/base/UEditorLyrics.pas @@ -40,7 +40,7 @@ uses UTexture; type - TAlignmentType = (atLeft, atCenter, atRight); + alignment = (left, center, right); TWord = record X: real; @@ -58,7 +58,7 @@ type TEditorLyrics = class private - AlignI: TAlignmentType; + AlignI: alignment; XR: real; YR: real; SizeR: real; @@ -69,7 +69,7 @@ type procedure SetX(Value: real); procedure SetY(Value: real); function GetClientX: real; - procedure SetAlign(Value: TAlignmentType); + procedure SetAlign(Value: alignment); function GetSize: real; procedure SetSize(Value: real); procedure SetSelected(Value: integer); @@ -96,7 +96,7 @@ type property X: real write SetX; property Y: real write SetY; property ClientX: real read GetClientX; - property Align: TAlignmentType write SetAlign; + property Align: alignment write SetAlign; property Size: real read GetSize write SetSize; property Selected: integer read SelectedI write SetSelected; property FontStyle: integer write SetFontStyle; @@ -137,7 +137,7 @@ begin Result := Word[0].X; end; -procedure TEditorLyrics.SetAlign(Value: TAlignmentType); +procedure TEditorLyrics.SetAlign(Value: alignment); begin AlignI := Value; end; @@ -229,7 +229,7 @@ var WordIndex: integer; TotalWidth: real; begin - if AlignI = atCenter then + if AlignI = center then begin TotalWidth := 0; for WordIndex := 0 to High(Word) do diff --git a/unicode/src/base/UGraphic.pas b/unicode/src/base/UGraphic.pas index 818e49aa..17175d02 100644 --- a/unicode/src/base/UGraphic.pas +++ b/unicode/src/base/UGraphic.pas @@ -198,14 +198,7 @@ var Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture; Tex_Score_Ratings : array [0..7] of TTexture; - - // arrows for SelectSlide - Tex_SelectS_ArrowL: TTexture; - Tex_SelectS_ArrowR: TTexture; - - // textures for software mouse cursor - Tex_Cursor_Unpressed: TTexture; - Tex_Cursor_Pressed: TTexture; + const Skin_BGColorR = 1; Skin_BGColorG = 1; @@ -239,6 +232,17 @@ const Skin_OscG = 0; Skin_OscB = 0; + // TODO: add to theme ini file + Skin_LyricsT = 493; + Skin_LyricsUpperX = 80; + Skin_LyricsUpperW = 640; + Skin_LyricsUpperY = Skin_LyricsT; + Skin_LyricsUpperH = 41; + Skin_LyricsLowerX = 80; + Skin_LyricsLowerW = 640; + Skin_LyricsLowerY = Skin_LyricsT + Skin_LyricsUpperH + 1; + Skin_LyricsLowerH = 41; + Skin_SpectrumT = 470; Skin_SpectrumBot = 570; Skin_SpectrumH = 100; @@ -335,15 +339,6 @@ begin Tex_Ball := Texture.LoadTexture(Skin.GetTextureFileName('Ball'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); Tex_Lyric_Help_Bar := Texture.LoadTexture(Skin.GetTextureFileName('LyricHelpBar'), TEXTURE_TYPE_TRANSPARENT, $FF00FF); - Tex_SelectS_ArrowL := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowLeft'), TEXTURE_TYPE_TRANSPARENT, 0); - Tex_SelectS_ArrowR := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowRight'), TEXTURE_TYPE_TRANSPARENT, 0); - - Tex_Cursor_Unpressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor'), TEXTURE_TYPE_TRANSPARENT, 0); - - if (Skin.GetTextureFileName('Cursor_Pressed') <> '') then - Tex_Cursor_Pressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor_Pressed'), TEXTURE_TYPE_TRANSPARENT, 0) - else - Tex_Cursor_Pressed.TexNum := 0; //TimeBar mod Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar')); @@ -502,7 +497,6 @@ begin Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D'); Display := TDisplay.Create; - //Display.SetCursor; //Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2); @@ -635,15 +629,15 @@ begin begin Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen'); screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN ); + SDL_ShowCursor(0); end else begin Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed'); screen := SDL_SetVideoMode(W, H, 0, SDL_OPENGL or SDL_RESIZABLE); + SDL_ShowCursor(1); end; - SDL_ShowCursor(0); - if (screen = nil) then begin Log.LogCritical('SDL_SetVideoMode Failed', 'Initialize3D'); diff --git a/unicode/src/base/UImage.pas b/unicode/src/base/UImage.pas index 60b0a3a2..8dc38495 100644 --- a/unicode/src/base/UImage.pas +++ b/unicode/src/base/UImage.pas @@ -311,13 +311,13 @@ var hour, minute, second, msecond: word; begin DecodeDate(time, year, month, day); - pngTime.year := png_uint_16(year); - pngTime.month := png_byte(month); - pngTime.day := png_byte(day); + pngTime.year := year; + pngTime.month := month; + pngTime.day := day; DecodeTime(time, hour, minute, second, msecond); - pngTime.hour := png_byte(hour); - pngTime.minute := png_byte(minute); - pngTime.second := png_byte(second); + pngTime.hour := hour; + pngTime.minute := minute; + pngTime.second := second; end; (* @@ -896,13 +896,8 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal); // replaced by division of longwords, shifted by 10 bits to keep // digits. - // The use of longwards leeds to some type size mismatch warnings - // whenever differences are formed. - // This should not be a problem, since the results should all be positive. - // replacing longword by longint would probably resolve this cosmetic fault :-) - function ColorToHue(const Color: longword): longword; - // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024 + // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024 var Red, Green, Blue: longword; Min, Max, Delta: longword; @@ -924,8 +919,7 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal); if Blue > Max then Max := Blue; // calc hue - Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0 - // But the assignments above are easy enough to be sure, that Max - Min is >= 0. + Delta := Max - Min; if (Delta = 0) then Result := 0 else @@ -1029,19 +1023,16 @@ begin end else // all colors except black and white begin - Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0 - // But the assignments above are easy enough to be sure, that Max - Min is >= 0. + Delta := Max - Min; Sat := (Delta shl 10) div Max; // shl 10 - // shr 10 corrects that Sat and f are shl 10 + // shr 10 corrects that sat and f are shl 10 // the resulting p, q and t are unshifted p := (Max*(1024-Sat)) shr 10; q := (Max*(1024-(Sat*f) shr 10)) shr 10; t := (Max*(1024-(Sat*(1024-f)) shr 10)) shr 10; - // The above 3 lines give type size mismatch warning, but all variables are longword and the ranges should be ok. - case HueInteger of 0: begin Red := Max; Green := t; Blue := p; end; // (v,t,p) 1: begin Red := q; Green := Max; Blue := p; end; // (q,v,p) @@ -1052,13 +1043,13 @@ begin end; {$IFDEF FPC_BIG_ENDIAN} - PixelColors[3] := byte(Red); - PixelColors[2] := byte(Green); - PixelColors[1] := byte(Blue); + PixelColors[3] := Red; + PixelColors[2] := Green; + PixelColors[1] := Blue {$ELSE} - PixelColors[0] := byte(Red); - PixelColors[1] := byte(Green); - PixelColors[2] := byte(Blue); + PixelColors[0] := Red; + PixelColors[1] := Green; + PixelColors[2] := Blue; {$ENDIF} end; diff --git a/unicode/src/base/UIni.pas b/unicode/src/base/UIni.pas index 61c39d32..241b34e8 100644 --- a/unicode/src/base/UIni.pas +++ b/unicode/src/base/UIni.pas @@ -78,7 +78,6 @@ type function ReadArrayIndex(const SearchArray: array of string; IniFile: TCustomIniFile; IniSection: string; IniProperty: string; Default: integer): integer; - procedure TranslateOptionValues; procedure LoadInputDeviceCfg(IniFile: TMemIniFile); procedure SaveInputDeviceCfg(IniFile: TIniFile); procedure LoadThemes(IniFile: TCustomIniFile); @@ -156,7 +155,6 @@ type // Controller Joypad: integer; - Mouse: integer; // default encoding for texts (lyrics, song-name, ...) EncodingDefault: TEncoding; @@ -200,13 +198,14 @@ const IBackgroundMusic: array[0..1] of string = ('Off', 'On'); - ITextureSize: array[0..3] of string = ('64', '128', '256', '512'); - ITextureSizeVals: array[0..3] of integer = ( 64, 128, 256, 512); + ITextureSize: array[0..2] of string = ('128', '256', '512'); + ITextureSizeVals: array[0..2] of integer = ( 128, 256, 512); ISingWindow: array[0..1] of string = ('Small', 'Big'); //SingBar Mod - IOscilloscope: array[0..1] of string = ('Off', 'On'); + IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar'); +//IOscilloscope: array[0..1] of string = ('Off', 'On'); ISpectrum: array[0..1] of string = ('Off', 'On'); ISpectrograph: array[0..1] of string = ('Off', 'On'); @@ -247,75 +246,15 @@ const IScreenFade: array[0..1] of string = ('Off', 'On'); IAskbeforeDel: array[0..1] of string = ('Off', 'On'); IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonus: array[0..1] of string = ('Off', 'On'); + ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes'); IPartyPopup: array[0..1] of string = ('Off', 'On'); IJoypad: array[0..1] of string = ('Off', 'On'); - IMouse: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor'); // Recording options IChannelPlayer: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); -var - IDifficultyTranslated: array[0..2] of string = ('Easy', 'Medium', 'Hard'); - ITabsTranslated: array[0..1] of string = ('Off', 'On'); - - ISortingTranslated: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2'); - - IDebugTranslated: array[0..1] of string = ('Off', 'On'); - - IFullScreenTranslated: array[0..1] of string = ('Off', 'On'); - IVisualizerTranslated: array[0..2] of string = ('Off', 'WhenNoVideo','On'); - - IBackgroundMusicTranslated: array[0..1] of string = ('Off', 'On'); - ISingWindowTranslated: array[0..1] of string = ('Small', 'Big'); - - //SingBar Mod - IOscilloscopeTranslated: array[0..1] of string = ('Off', 'On'); - - ISpectrumTranslated: array[0..1] of string = ('Off', 'On'); - ISpectrographTranslated: array[0..1] of string = ('Off', 'On'); - IMovieSizeTranslated: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]'); - - IClickAssistTranslated: array[0..1] of string = ('Off', 'On'); - IBeatClickTranslated: array[0..1] of string = ('Off', 'On'); - ISavePlaybackTranslated: array[0..1] of string = ('Off', 'On'); - - IVoicePassthroughTranslated: array[0..1] of string = ('Off', 'On'); - - //Song Preview - IPreviewVolumeTranslated: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%'); - - IAudioOutputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536'); - - IAudioInputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536'); - - IPreviewFadingTranslated: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs'); - - ILyricsFontTranslated: array[0..2] of string = ('Plain', 'OLine1', 'OLine2'); - ILyricsEffectTranslated: array[0..4] of string = ('Simple', 'Zoom', 'Slide', 'Ball', 'Shift'); - ISolmizationTranslated: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American'); - INoteLinesTranslated: array[0..1] of string = ('Off', 'On'); - - IColorTranslated: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black'); - - // Advanced - ILoadAnimationTranslated: array[0..1] of string = ('Off', 'On'); - IEffectSingTranslated: array[0..1] of string = ('Off', 'On'); - IScreenFadeTranslated: array[0..1] of string = ('Off', 'On'); - IAskbeforeDelTranslated: array[0..1] of string = ('Off', 'On'); - IOnSongClickTranslated: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu'); - ILineBonusTranslated: array[0..1] of string = ('Off', 'On'); - IPartyPopupTranslated: array[0..1] of string = ('Off', 'On'); - - IJoypadTranslated: array[0..1] of string = ('Off', 'On'); - IMouseTranslated: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor'); - - // Recording options - IChannelPlayerTranslated: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6'); - IMicBoostTranslated: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB'); - implementation uses @@ -331,188 +270,6 @@ uses UUnicodeUtils; (** - * Translate and set the values of options, which need translation. - *) -procedure TIni.TranslateOptionValues; -begin - ULanguage.Language.ChangeLanguage(ILanguage[Language]); - - IDifficultyTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EASY'); - IDifficultyTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_MEDIUM'); - IDifficultyTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_HARD'); - - ITabsTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ITabsTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ISortingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EDITION'); - ISortingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GENRE'); - ISortingTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_LANGUAGE'); - ISortingTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_FOLDER'); - ISortingTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_TITLE'); - ISortingTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST'); - ISortingTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_TITLE2'); - ISortingTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST2'); - - IDebugTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IDebugTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IFullScreenTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IFullScreenTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IVisualizerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IVisualizerTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_WHENNOVIDEO'); - IVisualizerTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IBackgroundMusicTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IBackgroundMusicTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ISingWindowTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SMALL'); - ISingWindowTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_BIG'); - - IOscilloscopeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IOscilloscopeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ISpectrumTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ISpectrumTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ISpectrographTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ISpectrographTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IMovieSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_HALF'); - IMovieSizeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID'); - IMovieSizeTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID_BG'); - - IClickAssistTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IClickAssistTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IBeatClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IBeatClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ISavePlaybackTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ISavePlaybackTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IVoicePassthroughTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IVoicePassthroughTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - ILyricsFontTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_PLAIN'); - ILyricsFontTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_OLINE1'); - ILyricsFontTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OLINE2'); - - ILyricsEffectTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SIMPLE'); - ILyricsEffectTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ZOOM'); - ILyricsEffectTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SLIDE'); - ILyricsEffectTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_BALL'); - ILyricsEffectTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_SHIFT'); - - ISolmizationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ISolmizationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_EURO'); - ISolmizationTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_JAPAN'); - ISolmizationTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_AMERICAN'); - - INoteLinesTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - INoteLinesTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IColorTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_BLUE'); - IColorTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GREEN'); - IColorTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_PINK'); - IColorTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_RED'); - IColorTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_VIOLET'); - IColorTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ORANGE'); - IColorTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_YELLOW'); - IColorTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_BROWN'); - IColorTranslated[8] := ULanguage.Language.Translate('OPTION_VALUE_BALCK'); - - // Advanced - ILoadAnimationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ILoadAnimationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IEffectSingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IEffectSingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IScreenFadeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IScreenFadeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IAskbeforeDelTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IAskbeforeDelTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IOnSongClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SING'); - IOnSongClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_SELECT_PLAYERS'); - IOnSongClickTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OPEN_MENU'); - - ILineBonusTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - ILineBonusTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IPartyPopupTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IPartyPopupTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IJoypadTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IJoypadTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON'); - - IMouseTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IMouseTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_HARDWARE_CURSOR'); - IMouseTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SOFTWARE_CURSOR'); - - IAudioOutputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO'); - IAudioOutputBufferSizeTranslated[1] := '256'; - IAudioOutputBufferSizeTranslated[2] := '512'; - IAudioOutputBufferSizeTranslated[3] := '1024'; - IAudioOutputBufferSizeTranslated[4] := '2048'; - IAudioOutputBufferSizeTranslated[5] := '4096'; - IAudioOutputBufferSizeTranslated[6] := '8192'; - IAudioOutputBufferSizeTranslated[7] := '16384'; - IAudioOutputBufferSizeTranslated[8] := '32768'; - IAudioOutputBufferSizeTranslated[9] := '65536'; - - - IAudioInputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO'); - IAudioInputBufferSizeTranslated[1] := '256'; - IAudioInputBufferSizeTranslated[2] := '512'; - IAudioInputBufferSizeTranslated[3] := '1024'; - IAudioInputBufferSizeTranslated[4] := '2048'; - IAudioInputBufferSizeTranslated[5] := '4096'; - IAudioInputBufferSizeTranslated[6] := '8192'; - IAudioInputBufferSizeTranslated[7] := '16384'; - IAudioInputBufferSizeTranslated[8] := '32768'; - IAudioInputBufferSizeTranslated[9] := '65536'; - - //Song Preview - IPreviewVolumeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IPreviewVolumeTranslated[1] := '10%'; - IPreviewVolumeTranslated[2] := '20%'; - IPreviewVolumeTranslated[3] := '30%'; - IPreviewVolumeTranslated[4] := '40%'; - IPreviewVolumeTranslated[5] := '50%'; - IPreviewVolumeTranslated[6] := '60%'; - IPreviewVolumeTranslated[7] := '70%'; - IPreviewVolumeTranslated[8] := '80%'; - IPreviewVolumeTranslated[9] := '90%'; - IPreviewVolumeTranslated[10] := '100%'; - - - IPreviewFadingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IPreviewFadingTranslated[1] := '1 ' + ULanguage.Language.Translate('OPTION_VALUE_SEC'); - IPreviewFadingTranslated[2] := '2 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); - IPreviewFadingTranslated[3] := '3 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); - IPreviewFadingTranslated[4] := '4 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); - IPreviewFadingTranslated[5] := '5 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS'); - - // Recording options - IChannelPlayerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IChannelPlayerTranslated[1] := '1'; - IChannelPlayerTranslated[2] := '2'; - IChannelPlayerTranslated[3] := '3'; - IChannelPlayerTranslated[4] := '4'; - IChannelPlayerTranslated[5] := '5'; - IChannelPlayerTranslated[6] := '6'; - - IMicBoostTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF'); - IMicBoostTranslated[1] := '+6dB'; - IMicBoostTranslated[2] := '+12dB'; - IMicBoostTranslated[3] := '+18dB'; - -end; - -(** * Returns the filename without its fileextension *) function TIni.RemoveFileExt(FullName: string): string; @@ -836,7 +593,6 @@ begin end; // reverse order - Log.LogStatus( 'Log size of resolution: ' + IntToStr(Length(IResolution)), 'Video'); for I := 0 to (Length(IResolution) div 2) - 1 do begin swap(IResolution[I], IResolution[High(IResolution)-I]); @@ -930,7 +686,7 @@ begin SingWindow := GetArrayIndex(ISingWindow, IniFile.ReadString('Graphics', 'SingWindow', 'Big')); // Oscilloscope - Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', IOscilloscope[0])); + Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar')); // Spectrum Spectrum := GetArrayIndex(ISpectrum, IniFile.ReadString('Graphics', 'Spectrum', 'Off')); @@ -957,16 +713,16 @@ begin PreviewVolume := GetArrayIndex(IPreviewVolume, IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7])); //Preview Fading - PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[3])); + PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1])); //AudioRepeat aka VoicePassthrough VoicePassthrough := GetArrayIndex(IVoicePassthrough, IniFile.ReadString('Sound', 'VoicePassthrough', IVoicePassthrough[0])); // Lyrics Font - LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[0])); + LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1])); // Lyrics Effect - LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[2])); + LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1])); // Solmization Solmization := GetArrayIndex(ISolmization, IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0])); @@ -1014,7 +770,7 @@ begin OnSongClick := GetArrayIndex(IOnSongClick, IniFile.ReadString('Advanced', 'OnSongClick', 'Sing')); // Linebonus - LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', ILineBonus[1])); + LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', 'At Score')); // PartyPopup PartyPopup := GetArrayIndex(IPartyPopup, IniFile.ReadString('Advanced', 'PartyPopup', 'On')); @@ -1022,13 +778,8 @@ begin // Joypad Joypad := GetArrayIndex(IJoypad, IniFile.ReadString('Controller', 'Joypad', IJoypad[0])); - // Mouse - Mouse := GetArrayIndex(IMouse, IniFile.ReadString('Controller', 'Mouse', IMouse[2])); - LoadPaths(IniFile); - TranslateOptionValues; - IniFile.Free; end; @@ -1169,9 +920,6 @@ begin // Joypad IniFile.WriteString('Controller', 'Joypad', IJoypad[Joypad]); - // Mouse - IniFile.WriteString('Controller', 'Mouse', IMouse[Mouse]); - // Directories (add a template if section is missing) // Note: Value must be ' ' and not '', otherwise no key is generated on Linux if (not IniFile.SectionExists('Directories')) then diff --git a/unicode/src/base/UMain.pas b/unicode/src/base/UMain.pas index 1962e953..8d11b91d 100644 --- a/unicode/src/base/UMain.pas +++ b/unicode/src/base/UMain.pas @@ -66,6 +66,11 @@ implementation uses Math, gl, +{ + SDL_ttf, + UParty, + UCore, +} UCatCovers, UCommandLine, UCommon, @@ -83,12 +88,10 @@ uses UPath, UPlaylist, UMusic, - UBeatTimer, UPlatform, USkins, USongs, UThemes, - UParty, UTime; procedure Main; @@ -233,12 +236,14 @@ begin Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PluginManager', 1); +{ // Party Mode Manager Log.BenchmarkStart(1); Log.LogStatus('PartySession Manager', 'Initialization'); PartySession := TPartySession.Create; //Load PartySession Log.BenchmarkEnd(1); Log.LogBenchmark('Loading PartySession Manager', 1); +} // Graphics Log.BenchmarkStart(1); @@ -359,11 +364,9 @@ begin CountMidTime; Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid); - Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay)); if Delay >= 1 then SDL_Delay(Delay); // dynamic, maximum is 100 fps - Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay)); CountSkipTime; @@ -377,26 +380,9 @@ begin end; end; -procedure DoQuit; -begin - // if question option is enabled then show exit popup - if (Ini.AskbeforeDel = 1) then - begin - Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); - end - else // if ask-for-exit is disabled then simply exit - begin - Display.Fade := 0; - Display.NextScreenWithCheck := nil; - Display.CheckOK := true; - end; -end; - procedure CheckEvents; var - Event: TSDL_event; - mouseDown: boolean; - mouseBtn: integer; + Event: TSDL_event; begin if Assigned(Display.NextScreen) then Exit; @@ -410,46 +396,17 @@ begin Display.NextScreenWithCheck := nil; Display.CheckOK := true; end; - - SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP: + SDL_MOUSEBUTTONDOWN: begin - if (Ini.Mouse > 0) then +{ + with Event.button do begin - case Event.type_ of - SDL_MOUSEMOTION: - begin - mouseDown := false; - mouseBtn := 0; - end; - SDL_MOUSEBUTTONDOWN: - begin - mouseDown := true; - mouseBtn := Event.button.button; - end; - SDL_MOUSEBUTTONUP: - begin - mouseDown := false; - mouseBtn := Event.button.button; - end; - end; - - Display.MoveCursor(Event.button.X * 800 / Screen.w, - Event.button.Y * 600 / Screen.h, - mouseDown and ((mouseBtn <> SDL_BUTTON_WHEELDOWN) or (mouseBtn <> SDL_BUTTON_WHEELUP))); - - if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then - done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) - else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then - done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y) - else + if State = SDL_BUTTON_LEFT then begin - done := not Display.CurrentScreen^.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y); - - // if screen wants to exit - if done then - DoQuit; + // end; end; +} end; SDL_VIDEORESIZE: begin @@ -485,14 +442,14 @@ begin if boolean( Ini.FullScreen ) then begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN); + SDL_ShowCursor(0); end else begin SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE); + SDL_ShowCursor(1); end; - Display.SetCursor; - glViewPort(0, 0, ScreenW, ScreenH); {$IFEND} end @@ -512,7 +469,19 @@ begin // if screen wants to exit if Done then - DoQuit; + begin + // if question option is enabled then show exit popup + if (Ini.AskbeforeDel = 1) then + begin + Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX'); + end + else // if ask-for-exit is disabled then simply exit + begin + Display.Fade := 0; + Display.NextScreenWithCheck := nil; + Display.CheckOK := true; + end; + end; end; end; diff --git a/unicode/src/base/UMusic.pas b/unicode/src/base/UMusic.pas index 5fc9805f..19c3b942 100644 --- a/unicode/src/base/UMusic.pas +++ b/unicode/src/base/UMusic.pas @@ -36,8 +36,7 @@ interface uses UTime, SysUtils, - Classes, - UBeatTimer; + Classes; type TNoteType = (ntFreestyle, ntNormal, ntGolden); @@ -100,6 +99,51 @@ type Line: array of TLine; end; + (** + * TLyricsState contains all information concerning the + * state of the lyrics, e.g. the current beat or duration of the lyrics. + *) + TLyricsState = class + private + Timer: TRelativeTimer; // keeps track of the current time + public + OldBeat: integer; // previous discovered beat + CurrentBeat: integer; // current beat (rounded) + MidBeat: real; // current beat (float) + + // now we use this for super synchronization! + // only used when analyzing voice + // TODO: change ...D to ...Detect(ed) + OldBeatD: integer; // previous discovered beat + CurrentBeatD: integer; // current discovered beat (rounded) + MidBeatD: real; // current discovered beat (float) + + // we use this for audible clicks + // TODO: Change ...C to ...Click + OldBeatC: integer; // previous discovered beat + CurrentBeatC: integer; + MidBeatC: real; // like CurrentBeatC + + OldLine: integer; // previous displayed sentence + + StartTime: real; // time till start of lyrics (= Gap) + TotalTime: real; // total song time + + constructor Create(); + procedure Pause(); + procedure Resume(); + + procedure Reset(); + procedure UpdateBeats(); + + (** + * current song time (in seconds) used as base-timer for lyrics etc. + *) + function GetCurrentTime(): real; + procedure SetCurrentTime(Time: real); + end; + + const FFTSize = 512; // size of FFT data (output: FFTSize/2 values) type @@ -933,6 +977,92 @@ begin end; end; + +{ TVoiceRemoval } + +constructor TLyricsState.Create(); +begin + // create a triggered timer, so we can Pause() it, set the time + // and Resume() it afterwards for better synching. + Timer := TRelativeTimer.Create(true); + + // reset state + Reset(); +end; + +procedure TLyricsState.Pause(); +begin + Timer.Pause(); +end; + +procedure TLyricsState.Resume(); +begin + Timer.Resume(); +end; + +procedure TLyricsState.SetCurrentTime(Time: real); +begin + // do not start the timer (if not started already), + // after setting the current time + Timer.SetTime(Time, false); +end; + +function TLyricsState.GetCurrentTime(): real; +begin + Result := Timer.GetTime(); +end; + +(** + * Resets the timer and state of the lyrics. + * The timer will be stopped afterwards so you have to call Resume() + * to start the lyrics timer. + *) +procedure TLyricsState.Reset(); +begin + Pause(); + SetCurrentTime(0); + + StartTime := 0; + TotalTime := 0; + + OldBeat := -1; + MidBeat := -1; + CurrentBeat := -1; + + OldBeatC := -1; + MidBeatC := -1; + CurrentBeatC := -1; + + OldBeatD := -1; + MidBeatD := -1; + CurrentBeatD := -1; +end; + +(** + * Updates the beat information (CurrentBeat/MidBeat/...) according to the + * current lyric time. + *) +procedure TLyricsState.UpdateBeats(); +var + CurLyricsTime: real; +begin + CurLyricsTime := GetCurrentTime(); + + OldBeat := CurrentBeat; + MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000); + CurrentBeat := Floor(MidBeat); + + OldBeatC := CurrentBeatC; + MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000); + CurrentBeatC := Floor(MidBeatC); + + OldBeatD := CurrentBeatD; + // MidBeatD = MidBeat with additional GAP + MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000); + CurrentBeatD := Floor(MidBeatD); +end; + + { TAudioConverter } function TAudioConverter.Init(SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): boolean; diff --git a/unicode/src/base/UNote.pas b/unicode/src/base/UNote.pas index 6da4cf07..5e70bfe1 100644 --- a/unicode/src/base/UNote.pas +++ b/unicode/src/base/UNote.pas @@ -126,10 +126,12 @@ uses UDLLManager, UParty, UConfig, + UCore, UCommon, UGraphic, UGraphicClasses, UPath, + UPluginDefs, UPlatform, UThemes; diff --git a/unicode/src/base/UParty.pas b/unicode/src/base/UParty.pas index b02d13be..937aab78 100644 --- a/unicode/src/base/UParty.pas +++ b/unicode/src/base/UParty.pas @@ -34,85 +34,208 @@ interface {$I switches.inc} uses - ModiSDK; + UPartyDefs, + UCoreModule, + UPluginDefs; type + ARounds = array [0..252] of integer; //0..252 needed for + PARounds = ^ARounds; + TRoundInfo = record - Plugin: word; + Modi: cardinal; Winner: byte; end; TeamOrderEntry = record - TeamNum: byte; - Score: byte; + Teamnum: byte; + Score: byte; end; TeamOrderArray = array[0..5] of byte; - TPartyPlugin = record - ID: byte; - TimesPlayed: byte; + TUS_ModiInfoEx = record + Info: TUS_ModiInfo; + Owner: integer; + TimesPlayed: byte; //Helper for setting round plugins end; - TPartySession = class + TPartySession = class (TCoreModule) private - function GetRandomPlayer(Team: byte): byte; - function GetRandomPlugin(Plugins: array of TPartyPlugin): byte; - function IsWinner(Player, Winner: byte): boolean; - procedure GenScores; - public - Teams: TTeamInfo; - Rounds: array of TRoundInfo; + bPartyMode: boolean; //Is this party or single player CurRound: byte; - constructor Create; + Modis: array of TUS_ModiInfoEx; + Teams: TTeamInfo; - procedure StartNewParty(NumRounds: byte); - procedure StartRound; - procedure EndRound; - function GetTeamOrder: TeamOrderArray; - function GetWinnerString(Round: byte): string; + function IsWinner(Player, Winner: byte): boolean; + procedure GenScores; + function GetRandomPlugin(TeamMode: boolean): cardinal; + function GetRandomPlayer(Team: byte): byte; + public + //Teams: TTeamInfo; + Rounds: array of TRoundInfo; + + //TCoreModule methods to inherit + constructor Create; override; + procedure Info(const pInfo: PModuleInfo); override; + function Load: boolean; override; + function Init: boolean; override; + procedure DeInit; override; + destructor Destroy; override; + + //Register modus service + function RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer; //Registers a new modus. wParam: Pointer to TUS_ModiInfo + + //Start new Party + function StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer; //Starts new party mode. Returns non zero on success + function GetCurModi(wParam: TwParam; lParam: TlParam): integer; //Returns pointer to cur. Modis TUS_ModiInfo (to Use with Singscreen) + function StopParty(wParam: TwParam; lParam: TlParam): integer; //Stops party mode. Returns 1 if party mode was enabled before. + function NextRound(wParam: TwParam; lParam: TlParam): integer; //Increases curround by 1; Returns num of round or -1 if last round is already played + + function CallModiInit(wParam: TwParam; lParam: TlParam): integer; //Calls curmodis init proc. If an error occurs, returns nonzero. In this case a new plugin was selected. Please renew loading + function CallModiDeInit(wParam: TwParam; lParam: TlParam): integer; //Calls DeInitProc and ends the round + + function GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Writes TTeamInfo record to pointer at lParam. Returns zero on success + function SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Read TTeamInfo record from pointer at lParam. Returns zero on success + + function GetTeamOrder(wParam: TwParam; lParam: TlParam): integer; //Returns team order. Structure: Bits 1..3: Team at place1; Bits 4..6: Team at place2 ... + function GetWinnerString(wParam: TwParam; lParam: TlParam): integer; //wParam is roundnum. If (Pointer = nil) then return length of the string. Otherwise write the string to address at lParam end; -var - PartySession: TPartySession; +const + StandardModus = 0; //Modus ID that will be played in non-party mode implementation uses - UDLLManager, + UCore, UGraphic, - UNote, ULanguage, - ULog; + ULog, + UNote, + SysUtils; +{********************* + TPluginLoader + Implentation +*********************} + +//------------- +// function that gives some infos about the module to the core +//------------- +procedure TPartySession.Info(const pInfo: PModuleInfo); +begin + pInfo^.Name := 'TPartySession'; + pInfo^.Version := MakeVersion(1,0,0,chr(0)); + pInfo^.Description := 'Manages party modi and party game'; +end; + +//------------- +// Just the constructor +//------------- constructor TPartySession.Create; begin inherited; + //UnSet PartyMode + bPartyMode := false; +end; + +//------------- +//Is called on loading. +//In this method only events and services should be created +//to offer them to other modules or plugins during the init process +//If false is returned this will cause a forced exit +//------------- +function TPartySession.Load: boolean; +begin + //Add register party modus service + Result := true; + Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi); + Core.Services.AddService('Party/StartParty', nil, Self.StartParty); + Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi); +end; + +//------------- +//Is called on init process +//In this method you can hook some events and create + init +//your classes, variables etc. +//If false is returned this will cause a forced exit +//------------- +function TPartySession.Init: boolean; +begin + //Just set private var to true. + Result := true; +end; + +//------------- +//Is called if this module has been inited and there is an exit. +//Deinit is in reverse initing order +//------------- +procedure TPartySession.DeInit; +begin + //Force DeInit +end; + +//------------- +//Is called if this module will be unloaded and has been created +//Should be used to free memory +//------------- +destructor TPartySession.Destroy; +begin + //Just save some memory if it wasn't done now.. + SetLength(Modis, 0); + inherited; +end; + +//------------- +// Registers a new modus. wParam: Pointer to TUS_ModiInfo +// Service for plugins +//------------- +function TPartySession.RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer; +var + Len: integer; + Info: PUS_ModiInfo; +begin + Info := PModiInfo; + //Copy Info if cbSize is correct + if (Info.cbSize = SizeOf(TUS_ModiInfo)) then + begin + Len := Length(Modis); + SetLength(Modis, Len + 1); + + Modis[Len].Info := Info^; + end + else + Core.ReportError(integer(PChar('Plugins try to register modus with wrong pointer, or wrong TUS_ModiInfo record.')), PChar('TPartySession')); + + // FIXME: return a valid result + Result := 0; end; //---------- // Returns a number of a random plugin //---------- -function TPartySession.GetRandomPlugin(Plugins: array of TPartyPlugin): byte; +function TPartySession.GetRandomPlugin(TeamMode: boolean): cardinal; var - LowestTP: byte; + LowestTP: byte; NumPwithLTP: word; - I: integer; - R: word; + I: integer; + R: word; begin + Result := StandardModus; //If there are no matching modi, play standard modus LowestTP := high(byte); NumPwithLTP := 0; //Search for Plugins not often played yet - for I := 0 to high(Plugins) do + for I := 0 to high(Modis) do begin - if (Plugins[I].TimesPlayed < lowestTP) then + if (Modis[I].TimesPlayed < lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then begin - lowestTP := Plugins[I].TimesPlayed; + lowestTP := Modis[I].TimesPlayed; NumPwithLTP := 1; end - else if (Plugins[I].TimesPlayed = lowestTP) then + else if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then begin Inc(NumPwithLTP); end; @@ -122,97 +245,118 @@ begin R := Random(NumPwithLTP); //Search for random plugin - for I := 0 to high(Plugins) do + for I := 0 to high(Modis) do begin - if Plugins[I].TimesPlayed = LowestTP then + if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then begin //Plugin found if (R = 0) then begin - Result := Plugins[I].ID; - Inc(Plugins[I].TimesPlayed); + Result := I; + Inc(Modis[I].TimesPlayed); Break; end; + Dec(R); end; end; end; //---------- -//StartNewParty - Reset and prepares for new party +// Starts new party mode. Returns non zero on success //---------- -procedure TPartySession.StartNewParty(NumRounds: byte); +function TPartySession.StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer; var - Plugins: array of TPartyPlugin; + I: integer; + aiRounds: PARounds; TeamMode: boolean; - Len: integer; - I, J: integer; begin - //Set current round to 1 - CurRound := 255; + Result := 0; + if (Teams.NumTeams >= 1) and (NumRounds < High(byte)-1) then + begin + bPartyMode := false; + aiRounds := PAofIRounds; + + try + //Is this team mode (More than one player per team) ? + TeamMode := true; + for I := 0 to Teams.NumTeams-1 do + TeamMode := TeamMode and (Teams.Teaminfo[I].NumPlayers > 1); + + //Set Rounds + SetLength(Rounds, NumRounds); + + for I := 0 to High(Rounds) do + begin //Set plugins + if (aiRounds[I] = -1) then + Rounds[I].Modi := GetRandomPlugin(TeamMode) + else if (aiRounds[I] >= 0) and (aiRounds[I] <= High(Modis)) and (TeamMode or ((Modis[aiRounds[I]].Info.LoadingSettings and MLS_TeamOnly) = 0)) then + Rounds[I].Modi := aiRounds[I] + else + Rounds[I].Modi := StandardModus; + + Rounds[I].Winner := High(byte); //Set winner to not played + end; - PlayersPlay := Teams.NumTeams; + CurRound := High(byte); //Set CurRound to not defined - //Get team-mode and set joker, also set TimesPlayed - TeamMode := true; - for I := 0 to Teams.NumTeams - 1 do - begin - if Teams.Teaminfo[I].NumPlayers < 2 then - begin - TeamMode := false; - end; - //Set player attributes - for J := 0 to Teams.TeamInfo[I].NumPlayers-1 do - begin - Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0; + //Return true and set party mode + bPartyMode := true; + Result := 1; + + except + Core.ReportError(integer(PChar('Can''t start party mode.')), PChar('TPartySession')); end; - Teams.Teaminfo[I].Joker := Round(NumRounds * 0.7); - Teams.Teaminfo[I].Score := 0; end; +end; - //Fill plugin array - SetLength(Plugins, 0); - for I := 0 to high(DLLMan.Plugins) do - begin - if TeamMode or (not DLLMan.Plugins[I].TeamModeOnly) then - begin - //Add only those plugins playable with current PlayerConfiguration - Len := Length(Plugins); - SetLength(Plugins, Len + 1); - Plugins[Len].ID := I; - Plugins[Len].TimesPlayed := 0; - end; +//---------- +// Returns pointer to Cur. ModiInfoEx (to use with sing screen) +//---------- +function TPartySession.GetCurModi(wParam: TwParam; lParam: TlParam): integer; +begin + if (bPartyMode) and (CurRound <= High(Rounds)) then + begin //If PartyMode is enabled: + //Return the Plugin of the Cur Round + Result := integer(@Modis[Rounds[CurRound].Modi]); + end + else + begin //Return standard modus + Result := integer(@Modis[StandardModus]); end; +end; - //Set rounds - if (Length(Plugins) >= 1) then +//---------- +// Stops party mode. Returns 1 if party mode was enabled before and -1 if change was not possible +//---------- +function TPartySession.StopParty(wParam: TwParam; lParam: TlParam): integer; +begin + Result := -1; + if (bPartyMode) then begin - SetLength (Rounds, NumRounds); - for I := 0 to NumRounds - 1 do - begin - PartySession.Rounds[I].Plugin := GetRandomPlugin(Plugins); - PartySession.Rounds[I].Winner := 255; - end; + // to-do : Whitü: Check here if sing screen is not shown atm. + bPartyMode := false; + Result := 1; end else - SetLength (Rounds, 0); + Result := 0; end; -{** - * Returns a random player to play next round - *} +//---------- +//GetRandomPlayer - gives back a random player to play next round +//---------- function TPartySession.GetRandomPlayer(Team: byte): byte; var - I, R: integer; - LowestTP: byte; + I, R: integer; + lowestTP: byte; NumPwithLTP: byte; begin - LowestTP := high(byte); + LowestTP := high(byte); NumPwithLTP := 0; - Result := 0; + Result := 0; //Search for players that have not often played yet - for I := 0 to Teams.Teaminfo[Team].NumPlayers - 1 do + for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do begin if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then begin @@ -225,11 +369,11 @@ begin end; end; - //Create random number + //Create random no R := Random(NumPwithLTP); //Search for random player - for I := 0 to Teams.Teaminfo[Team].NumPlayers - 1 do + for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do begin if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then begin @@ -245,93 +389,212 @@ begin end; end; -{** - * Prepares ScreenSingModi for next round and loads plugin - *} -procedure TPartySession.StartRound; +//---------- +// NextRound - Increases CurRound by 1; Returns num of round or -1 if last round is already played +//---------- +function TPartySession.NextRound(wParam: TwParam; lParam: TlParam): integer; var I: integer; begin if ((CurRound < high(Rounds)) or (CurRound = high(CurRound))) then - begin - //Increase Current Round + begin //everythings OK! -> Start the Round, maaaaan Inc(CurRound); - Rounds[CurRound].Winner := 255; - DllMan.LoadPlugin(Rounds[CurRound].Plugin); - - //Select Players - for I := 0 to Teams.NumTeams - 1 do + //Set Players to play this Round + for I := 0 to Teams.NumTeams-1 do Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I); + + // FIXME: return a valid result + Result := 0; + end + else + Result := -1; +end; + +//---------- +//IsWinner - returns true if the players bit is set in the winner byte +//---------- +function TPartySession.IsWinner(Player, Winner: byte): boolean; +var + Bit: byte; +begin + Bit := 1 shl Player; + + Result := ((Winner and Bit) = Bit); +end; + +//---------- +//GenScores - inc scores for cur. round +//---------- +procedure TPartySession.GenScores; +var + I: byte; +begin + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[CurRound].Winner) then + Inc(Teams.Teaminfo[I].Score); + end; +end; + +//---------- +// CallModiInit - calls CurModis Init Proc. If an error occurs, returns nonzero. In this case a new plugin was selected. Please renew loading +//---------- +function TPartySession.CallModiInit(wParam: TwParam; lParam: TlParam): integer; +begin + if (not bPartyMode) then + begin //Set rounds if not in party mode + SetLength(Rounds, 1); + Rounds[0].Modi := StandardModus; + Rounds[0].Winner := High(byte); + CurRound := 0; + end; - //Set ScreenSingModie Variables - ScreenSingModi.TeamInfo := Teams; + try + //Core. + except + on E : Exception do + begin + Core.ReportError(integer(PChar('Error starting modus: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), PChar('TPartySession')); + if (Rounds[CurRound].Modi = StandardModus) then + begin + Core.ReportError(integer(PChar('Can''t start standard modus, will exit now!')), PChar('TPartySession')); + Halt; + end + else //Select standard modus + begin + Rounds[CurRound].Modi := StandardModus + end; + end; end; + + // FIXME: return a valid result + Result := 0; end; //---------- -//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray +// CallModiDeInit - calls DeInitProc and ends the round //---------- -procedure TPartySession.EndRound; +function TPartySession.CallModiDeInit(wParam: TwParam; lParam: TlParam): integer; var - I: Integer; + I: integer; + MaxScore: word; begin - //Copy Winner - Rounds[CurRound].Winner := ScreenSingModi.Winner; - //Set Scores - GenScores; + if (bPartyMode) then + begin + //Get Winner Byte! + if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get winners from plugin + Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID) + else + begin //Create winners by score :/ + Rounds[CurRound].Winner := 0; + MaxScore := 0; + for I := 0 to Teams.NumTeams-1 do + begin + // to-do : recode percentage stuff + //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999; + if (Player[I].ScoreTotalInt > MaxScore) then + begin + MaxScore := Player[I].ScoreTotalInt; + Rounds[CurRound].Winner := 1 shl I; + end + else if (Player[I].ScoreTotalInt = MaxScore) and (Player[I].ScoreTotalInt <> 0) then + begin + Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I); + end; + end; + + + //When nobody has points -> everybody looses + if (MaxScore = 0) then + Rounds[CurRound].Winner := 0; + + end; - //Increase TimesPlayed 4 all Players - For I := 0 to Teams.NumTeams-1 do - Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed); + //Generate the scores + GenScores; + //Inc players TimesPlayed + if ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings and MLS_IncTP) = MLS_IncTP) then + begin + for I := 0 to Teams.NumTeams-1 do + Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed); + end; + end + else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then + Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID); + + // FIXME: return a valid result + Result := 0; end; //---------- -//IsWinner - returns true if the player's bit is set in the winner byte +// GetTeamInfo - writes TTeamInfo record to pointer at lParam. Returns zero on success //---------- -function TPartySession.IsWinner(Player, Winner: byte): boolean; +function TPartySession.GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; var - Mask: byte; + Info: ^TTeamInfo; begin - Mask := 1 shl Player; - Result := (Winner and Mask) <> 0; + Result := -1; + Info := pTeamInfo; + if (Info <> nil) then + begin + try + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Info^ := Teams; + Result := 0; + except + Result := -2; + end; + end; end; //---------- -//GenScores - increase scores for current round +// SetTeamInfo - read TTeamInfo record from pointer at lParam. Returns zero on success //---------- -procedure TPartySession.GenScores; +function TPartySession.SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; var - I: byte; + TeamInfobackup: TTeamInfo; + Info: ^TTeamInfo; begin - for I := 0 to Teams.NumTeams - 1 do + Result := -1; + Info := pTeamInfo; + if (Info <> nil) then begin - if isWinner(I, Rounds[CurRound].Winner) then - Inc(Teams.Teaminfo[I].Score); + try + TeamInfoBackup := Teams; + // to - do : Check Delphi memory management in this case + //Not sure if i had to copy PChars to a new address or if delphi manages this o0 + Teams := Info^; + Result := 0; + except + Teams := TeamInfoBackup; + Result := -2; + end; end; end; //---------- -//GetTeamOrder - returns the placement of each Team [First Position of Array is Teamnum of first placed Team, ...] +// GetTeamOrder - returns team order. Structure: Bits 1..3: Team at place1; Bits 4..6: Team at place2 ... //---------- -function TPartySession.GetTeamOrder: TeamOrderArray; +function TPartySession.GetTeamOrder(wParam: TwParam; lParam: TlParam): integer; var - I, J: integer; - ATeams: array [0..5] of TeamOrderEntry; + I, J: integer; + ATeams: array [0..5] of TeamOrderEntry; TempTeam: TeamOrderEntry; begin - // TODO: PartyMode: Write this in another way, so that teams with the same score get the same place + // to-do : PartyMode: Write this in another way, so that teams with the same score get the same place //Fill Team array - for I := 0 to Teams.NumTeams - 1 do + for I := 0 to Teams.NumTeams-1 do begin ATeams[I].Teamnum := I; ATeams[I].Score := Teams.Teaminfo[I].Score; end; //Sort teams - for J := 0 to Teams.NumTeams - 1 do - for I := 1 to Teams.NumTeams - 1 do + for J := 0 to Teams.NumTeams-1 do + for I := 1 to Teams.NumTeams-1 do if ATeams[I].Score > ATeams[I-1].Score then begin TempTeam := ATeams[I-1]; @@ -340,44 +603,63 @@ begin end; //Copy to Result + Result := 0; for I := 0 to Teams.NumTeams-1 do - Result[I] := ATeams[I].TeamNum; + Result := Result or (ATeams[I].TeamNum Shl I*3); end; //---------- -//GetWinnerString - Get string with WinnerTeam Name, when there is more than one Winner than Connect with and or , +// GetWinnerString - wParam is Roundnum. If (pointer = nil) then return length of the string. Otherwise write the string to address at lParam //---------- -function TPartySession.GetWinnerString(Round: byte): string; +function TPartySession.GetWinnerString(wParam: TwParam; lParam: TlParam): integer; var Winners: array of UTF8String; - I: integer; + I: integer; + ResultStr: String; + S: ^String; begin - Result := Language.Translate('PARTY_NOBODY'); - - if (Round > High(Rounds)) then - exit; + ResultStr := Language.Translate('PARTY_NOBODY'); - if (Rounds[Round].Winner = 0) then + if (wParam <= High(Rounds)) then begin - exit; + if (Rounds[wParam].Winner <> 0) then + begin + if (Rounds[wParam].Winner = 255) then + begin + ResultStr := Language.Translate('PARTY_NOTPLAYEDYET'); + end + else + begin + SetLength(Winners, 0); + for I := 0 to Teams.NumTeams-1 do + begin + if isWinner(I, Rounds[wParam].Winner) then + begin + SetLength(Winners, Length(Winners) + 1); + Winners[high(Winners)] := Teams.TeamInfo[I].Name; + end; + end; + ResultStr := Language.Implode(Winners); + end; + end; end; - if (Rounds[Round].Winner = 255) then - begin - Result := Language.Translate('PARTY_NOTPLAYEDYET'); - exit; - end; + //Now return what we have got + if (lParam = nil) then + begin //Return string length + Result := Length(ResultStr); + end + else + begin //Return string + try + S := lParam; + S^ := ResultStr; + Result := 0; + except + Result := -1; - SetLength(Winners, 0); - for I := 0 to Teams.NumTeams - 1 do - begin - if isWinner(I, Rounds[Round].Winner) then - begin - SetLength(Winners, Length(Winners) + 1); - Winners[high(Winners)] := Teams.TeamInfo[I].Name; end; end; - Result := Language.Implode(Winners); end; end. diff --git a/unicode/src/base/UPlatform.pas b/unicode/src/base/UPlatform.pas index 6f13481c..e4cb6f0c 100644 --- a/unicode/src/base/UPlatform.pas +++ b/unicode/src/base/UPlatform.pas @@ -43,9 +43,9 @@ uses type TDirectoryEntry = record - Name: WideString; - IsDirectory: boolean; - IsFile: boolean; + Name : WideString; + IsDirectory : boolean; + IsFile : boolean; end; TDirectoryEntryArray = array of TDirectoryEntry; @@ -54,12 +54,12 @@ type function GetExecutionDir(): string; procedure Init; virtual; function DirectoryFindFiles(Dir, Filter: WideString; ReturnAllSubDirs: boolean): TDirectoryEntryArray; virtual; abstract; - function TerminateIfAlreadyRunning(var WndTitle: string): boolean; virtual; + function TerminateIfAlreadyRunning(var WndTitle : string): boolean; virtual; function FindSongFile(Dir, Mask: WideString): WideString; virtual; procedure Halt; virtual; - function GetLogPath: WideString; virtual; abstract; - function GetGameSharedPath: WideString; virtual; abstract; - function GetGameUserPath: WideString; virtual; abstract; + function GetLogPath : WideString; virtual; abstract; + function GetGameSharedPath : WideString; virtual; abstract; + function GetGameUserPath : WideString; virtual; abstract; function CopyFile(const Source, Target: WideString; FailIfExists: boolean): boolean; virtual; end; @@ -79,13 +79,13 @@ uses ULog; -// I modified it to use the Platform_singleton in this location (in the implementation) +// I have modified it to use the Platform_singleton in this location ( in the implementaiton ) // so that this variable can NOT be overwritten from anywhere else in the application. // the accessor function platform, emulates all previous calls to work the same way. var - Platform_singleton: TPlatform; + Platform_singleton : TPlatform; -function Platform: TPlatform; +function Platform : TPlatform; begin Result := Platform_singleton; end; @@ -117,7 +117,7 @@ end; (** * Default TerminateIfAlreadyRunning() implementation *) -function TPlatform.TerminateIfAlreadyRunning(var WndTitle: string): boolean; +function TPlatform.TerminateIfAlreadyRunning(var WndTitle : string): Boolean; begin Result := false; end; @@ -143,7 +143,7 @@ const var SourceFile, TargetFile: TFileStream; FileCopyBuffer: array [0..COPY_BUFFER_SIZE-1] of byte; // temporary copy-buffer. - NumberOfBytes: integer; // number of bytes read from SourceFile + NumberOfBytes: integer; // number of bytes read from SourceFile begin Result := false; SourceFile := nil; diff --git a/unicode/src/base/URecord.pas b/unicode/src/base/URecord.pas index 2c2093a0..8f37262d 100644 --- a/unicode/src/base/URecord.pas +++ b/unicode/src/base/URecord.pas @@ -54,7 +54,7 @@ type function GetToneString: string; // converts a tone to its string represenatation; - procedure BoostBuffer(Buffer: PByteArray; Size: integer); + procedure BoostBuffer(Buffer: PByteArray; Size: cardinal); procedure ProcessNewBuffer(Buffer: PByteArray; BufferSize: integer); // we call it to analyze sound by checking Autocorrelation @@ -135,7 +135,7 @@ type procedure UpdateInputDeviceConfig; // handle microphone input - procedure HandleMicrophoneData(Buffer: PByteArray; Size: integer; + procedure HandleMicrophoneData(Buffer: PByteArray; Size: cardinal; InputDevice: TAudioInputDevice); end; @@ -459,7 +459,7 @@ begin Result := '-'; end; -procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: integer); +procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: cardinal); var i: integer; Value: longint; @@ -602,7 +602,7 @@ end; * Length - number of bytes in Buffer * Input - Soundcard-Input used for capture *} -procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: PByteArray; Size: integer; InputDevice: TAudioInputDevice); +procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: PByteArray; Size: cardinal; InputDevice: TAudioInputDevice); var MultiChannelBuffer: PByteArray; // buffer handled as array of bytes (offset relative to channel) SingleChannelBuffer: PByteArray; // temporary buffer for new samples per channel @@ -611,11 +611,13 @@ var CaptureChannel: TCaptureBuffer; AudioFormat: TAudioFormatInfo; SampleSize: integer; + SampleCount: integer; SamplesPerChannel: integer; i: integer; begin AudioFormat := InputDevice.AudioFormat; SampleSize := AudioSampleSize[AudioFormat.Format]; + SampleCount := Size div SampleSize; SamplesPerChannel := Size div AudioFormat.FrameSize; SingleChannelBufferSize := SamplesPerChannel * SampleSize; diff --git a/unicode/src/base/USingScores.pas b/unicode/src/base/USingScores.pas index c998644b..2d9b1e5e 100644 --- a/unicode/src/base/USingScores.pas +++ b/unicode/src/base/USingScores.pas @@ -34,211 +34,211 @@ interface {$I switches.inc} uses - gl, UThemes, + gl, UTexture; ////////////////////////////////////////////////////////////// // ATTENTION: // -// Enabled flag does not work atm. This should cause popups // -// not to move and scores to stay until re-enabling. // -// To use e.g. in pause mode // -// also invisible flag causes attributes not to change. // -// This should be fixed after next draw when visible = true,// -// but not tested yet // +// Enabled Flag does not Work atm. This should cause Popups // +// Not to Move and Scores to stay until Renenabling. // +// To use e.g. in Pause Mode // +// Also InVisible Flag causes Attributes not to change. // +// This should be fixed after next Draw when Visible = True,// +// but not testet yet // ////////////////////////////////////////////////////////////// -// some constants containing options that could change by time +//Some constants containing options that could change by time const - MaxPlayers = 6; // maximum of players that could be added - MaxPositions = 6; // maximum of score positions that could be added + MaxPlayers = 6; //Maximum of Players that could be added + MaxPositions = 6; //Maximum of Score Positions that could be added type //----------- - // TScorePlayer - record containing information about a players score + // TScorePlayer - Record Containing Information about a Players Score //----------- TScorePlayer = record - Position: byte; // index of the position where the player should be drawn - Enabled: boolean; // is the score display enabled - Visible: boolean; // is the score display visible - Score: word; // current score of the player - ScoreDisplayed: word; // score cur. displayed (for counting up) - ScoreBG: TTexture; // texture of the players scores bg - Color: TRGB; // the players color - RBPos: real; // cur. percentille of the rating bar - RBTarget: real; // target position of rating bar - RBVisible: boolean; // is rating bar drawn + Position: Byte; //Index of the Position where the Player should be Drawn + Enabled: Boolean; //Is the Score Display Enabled + Visible: Boolean; //Is the Score Display Visible + Score: Word; //Current Score of the Player + ScoreDisplayed: Word; //Score cur. Displayed(for counting up) + ScoreBG: TTexture;//Texture of the Players Scores BG + Color: TRGB; //Teh Players Color + RBPos: Real; //Cur. Percentille of the Rating Bar + RBTarget: Real; //Target Position of Rating Bar + RBVisible:Boolean; //Is Rating bar Drawn end; - aScorePlayer = array [0..MaxPlayers-1] of TScorePlayer; + aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer; //----------- - // TScorePosition - record containing information about a score position, that can be used + // TScorePosition - Record Containing Information about a Score Position, that can be used //----------- PScorePosition = ^TScorePosition; TScorePosition = record - // the position is used for which playercount - PlayerCount: byte; - // 1 - 1 player per screen - // 2 - 2 players per screen - // 4 - 3 players per screen - // 6 would be 2 and 3 players per screen - - BGX: real; // x position of the score bg - BGY: real; // y position of the score bg - BGW: real; // width of the score bg - BGH: real; // height of the score bg - - RBX: real; // x position of the rating bar - RBY: real; // y position of the rating bar - RBW: real; // width of the rating bar - RBH: real; // height of the rating bar - - TextX: real; // x position of the score text - TextY: real; // y position of the score text - TextFont: byte; // font of the score text - TextSize: integer; // size of the score text - - PUW: real; // width of the line bonus popup - PUH: real; // height of the line bonus popup - PUFont: byte; // font for the popups - PUFontSize: integer; // font size for the popups - PUStartX: real; // x start position of the line bonus popup - PUStartY: real; // y start position of the line bonus popup - PUTargetX: real; // x target position of the line bonus popup - PUTargetY: real; // y target position of the line bonus popup + //The Position is Used for Which Playercount + PlayerCount: Byte; + // 1 - One Player per Screen + // 2 - 2 Players per Screen + // 4 - 3 Players per Screen + // 6 would be 2 and 3 Players per Screen + + BGX: Real; //X Position of the Score BG + BGY: Real; //Y Position of the Score BG + BGW: Real; //Width of the Score BG + BGH: Real; //Height of the Score BG + + RBX: Real; //X Position of the Rating Bar + RBY: Real; //Y Position of the Rating Bar + RBW: Real; //Width of the Rating Bar + RBH: Real; //Height of the Rating Bar + + TextX: Real; //X Position of the Score Text + TextY: Real; //Y Position of the Score Text + TextFont: Byte; //Font of the Score Text + TextSize: integer; //Size of the Score Text + + PUW: Real; //Width of the LineBonus Popup + PUH: Real; //Height of the LineBonus Popup + PUFont: Byte; //Font for the PopUps + PUFontSize: integer; //FontSize for the PopUps + PUStartX: Real; //X Start Position of the LineBonus Popup + PUStartY: Real; //Y Start Position of the LineBonus Popup + PUTargetX: Real; //X Target Position of the LineBonus Popup + PUTargetY: Real; //Y Target Position of the LineBonus Popup end; - aScorePosition = array [0..MaxPositions-1] of TScorePosition; + aScorePosition = array[0..MaxPositions-1] of TScorePosition; //----------- - // TScorePopUp - record containing information about a line bonus popup - // list, next item is saved in next attribute + // TScorePopUp - Record Containing Information about a LineBonus Popup + // List, Next Item is Saved in Next attribute //----------- PScorePopUp = ^TScorePopUp; TScorePopUp = record - Player: byte; // index of the popups player - TimeStamp: cardinal; // timestamp of popups spawn - Rating: byte; // 0 to 8, type of rating (cool, bad, etc.) - ScoreGiven: word; // score that has already been given to the player - ScoreDiff: word; // difference between cur score at spawn and old score - Next: PScorePopUp; // next item in list + Player: Byte; //Index of the PopUps Player + TimeStamp: Cardinal; //Timestamp of Popups Spawn + Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.) + ScoreGiven:Word; //Score that has already been given to the Player + ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score + Next: PScorePopUp; //Next Item in List end; aScorePopUp = array of TScorePopUp; //----------- - // TSingScores - class containing scores positions and drawing scores, rating bar + popups + // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups //----------- TSingScores = class private Positions: aScorePosition; - aPlayers: aScorePlayer; - oPositionCount: byte; - oPlayerCount: byte; + aPlayers: aScorePlayer; + oPositionCount: Byte; + oPlayerCount: Byte; - // saves the first and last popup of the list + //Saves the First and Last Popup of the List FirstPopUp: PScorePopUp; LastPopUp: PScorePopUp; - // draws a popup by pointer + // Draws a Popup by Pointer procedure DrawPopUp(const PopUp: PScorePopUp); - // draws a score by playerindex - procedure DrawScore(const Index: integer); + // Draws a Score by Playerindex + procedure DrawScore(const Index: Integer); - // draws the rating bar by playerindex - procedure DrawRatingBar(const Index: integer); + // Draws the RatingBar by Playerindex + procedure DrawRatingBar(const Index: Integer); - // removes a popup w/o destroying the list + // Removes a PopUp w/o destroying the List procedure KillPopUp(const last, cur: PScorePopUp); public - Settings: record // Record containing some Displaying Options - Phase1Time: real; // time for phase 1 to complete (in msecs) - // the plop up of the popup - Phase2Time: real; // time for phase 2 to complete (in msecs) - // the moving (mainly upwards) of the popup - Phase3Time: real; // time for phase 3 to complete (in msecs) - // the fade out and score adding + Settings: record //Record containing some Displaying Options + Phase1Time: Real; //time for Phase 1 to complete (in msecs) + //The Plop Up of the PopUp + Phase2Time: Real; //time for Phase 2 to complete (in msecs) + //The Moving (mainly Upwards) of the Popup + Phase3Time: Real; //time for Phase 3 to complete (in msecs) + //The Fade out and Score adding - PopUpTex: array [0..8] of TTexture; // textures for every popup rating + PopUpTex: array [0..8] of TTexture; //Textures for every Popup Rating - RatingBar_BG_Tex: TTexture; // rating bar texs - RatingBar_FG_Tex: TTexture; - RatingBar_Bar_Tex: TTexture; + RatingBar_BG_Tex: TTexture; //Rating Bar Texs + RatingBar_FG_Tex: TTexture; + RatingBar_Bar_Tex: TTexture; end; - Visible: boolean; // visibility of all scores - Enabled: boolean; // scores are changed, popups are moved etc. - RBVisible: boolean; // visibility of all rating bars + Visible: Boolean; //Visibility of all Scores + Enabled: Boolean; //Scores are changed, PopUps are Moved etc. + RBVisible: Boolean; //Visibility of all Rating Bars - // properties for reading position and playercount - property PositionCount: byte read oPositionCount; - property PlayerCount: byte read oPlayerCount; - property Players: aScorePlayer read aPlayers; + //Propertys for Reading Position and Playercount + property PositionCount: Byte read oPositionCount; + property PlayerCount: Byte read oPlayerCount; + property Players: aScorePlayer read aPlayers; - // constructor just sets some standard settings + //Constructor just sets some standard Settings constructor Create; - // adds a position to array and increases position count + // Adds a Position to Array and Increases Position Count procedure AddPosition(const pPosition: PScorePosition); - // adds a player to array and increases player count - procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word = 0; const Enabled: boolean = true; const Visible: boolean = true); + // Adds a Player to Array and Increases Player Count + procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True); - // change a players visibility, enable - procedure ChangePlayerVisibility(const Index: byte; const pVisible: boolean); - procedure ChangePlayerEnabled(const Index: byte; const pEnabled: boolean); + //Change a Players Visibility, Enable + procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); + procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); - // deletes all player information + // Deletes all Player Information procedure ClearPlayers; - // deletes positions and playerinformation + // Deletes Positions and Playerinformation procedure Clear; - // loads some settings and the positions from theme + // Loads some Settings and the Positions from Theme procedure LoadfromTheme; - // has to be called after positions and players have been added, before first call of draw - // it gives every player a score position + // has to be called after Positions and Players have been added, before first call of Draw + //It gives every Player a Score Position procedure Init; - // spawns a new line bonus popup for the player - procedure SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word); + //Spawns a new Line Bonus PopUp for the Player + procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); - // removes all popups from mem + //Removes all PopUps from Mem procedure KillAllPopUps; - // draws scores and line bonus popups + // Draws Scores and Linebonus PopUps procedure Draw; end; + implementation -uses - SysUtils, - SDL, - TextGL, - ULog, - UGraphic; +uses SDL, + SysUtils, + ULog, + UGraphic, + TextGL; {** - * sets some standard settings + * Sets some standard Settings *} -constructor TSingScores.Create; +Constructor TSingScores.Create; begin inherited; - // clear popuplist pointers + //Clear PopupList Pointers FirstPopUp := nil; LastPopUp := nil; - // clear variables - Visible := true; - Enabled := true; - RBVisible := true; + //Clear Variables + Visible := True; + Enabled := True; + RBVisible := True; - // clear position index - oPositionCount := 0; - oPlayerCount := 0; + //Clear Position Index + oPositionCount := 0; + oPlayerCount := 0; Settings.Phase1Time := 350; // plop it up . -> [ ] Settings.Phase2Time := 550; // shift it up ^[ ]^ @@ -260,21 +260,22 @@ begin end; {** - * adds a position to array and increases position count + * Adds a Position to Array and Increases Position Count *} -procedure TSingScores.AddPosition(const pPosition: PScorePosition); +Procedure TSingScores.AddPosition(const pPosition: PScorePosition); begin if (PositionCount < MaxPositions) then begin Positions[PositionCount] := pPosition^; + Inc(oPositionCount); end; end; {** - * adds a player to array and increases player count + * Adds a Player to Array and Increases Player Count *} -procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word; const Enabled: boolean; const Visible: boolean); +Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean); begin if (PlayerCount < MaxPlayers) then begin @@ -282,48 +283,48 @@ begin aPlayers[PlayerCount].Enabled := Enabled; aPlayers[PlayerCount].Visible := Visible; aPlayers[PlayerCount].Score := Score; - aPlayers[PlayerCount].ScoreDisplayed := Score; + aPlayers[PlayerCount].ScoreDisplayed := Score; aPlayers[PlayerCount].ScoreBG := ScoreBG; aPlayers[PlayerCount].Color := Color; aPlayers[PlayerCount].RBPos := 0.5; aPlayers[PlayerCount].RBTarget := 0.5; - aPlayers[PlayerCount].RBVisible := true; + aPlayers[PlayerCount].RBVisible := True; Inc(oPlayerCount); end; end; {** - * change a players visibility + * Change a Players Visibility *} -procedure TSingScores.ChangePlayerVisibility(const Index: byte; const pVisible: boolean); +Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Visible := pVisible; end; {** - * change player enabled + * Change Player Enabled *} -procedure TSingScores.ChangePlayerEnabled(const Index: byte; const pEnabled: boolean); +Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean); begin if (Index < MaxPlayers) then aPlayers[Index].Enabled := pEnabled; end; {** - * procedure deletes all player information + * Procedure Deletes all Player Information *} -procedure TSingScores.ClearPlayers; +Procedure TSingScores.ClearPlayers; begin KillAllPopUps; oPlayerCount := 0; end; {** - * procedure deletes positions and playerinformation + * Procedure Deletes Positions and Playerinformation *} -procedure TSingScores.Clear; +Procedure TSingScores.Clear; begin KillAllPopUps; oPlayerCount := 0; @@ -331,16 +332,14 @@ begin end; {** - * procedure loads some settings and the positions from theme + * Procedure Loads some Settings and the Positions from Theme *} -procedure TSingScores.LoadfromTheme; -var - I: integer; - procedure AddbyStatics(const PC: byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); - var - nPosition: TScorePosition; +Procedure TSingScores.LoadfromTheme; +var I: Integer; + Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText); + var nPosition: TScorePosition; begin - nPosition.PlayerCount := PC; // only for one player playing + nPosition.PlayerCount := PC; //Only for one Player Playing nPosition.BGX := ScoreStatic.X; nPosition.BGY := ScoreStatic.Y; @@ -374,55 +373,54 @@ var begin Clear; - // set textures - // popup tex - for I := 0 to 8 do + //Set Textures + //Popup Tex + For I := 0 to 8 do Settings.PopUpTex[I] := Tex_SingLineBonusBack[I]; - // rating bar tex + //Rating Bar Tex Settings.RatingBar_BG_Tex := Tex_SingBar_Back; Settings.RatingBar_FG_Tex := Tex_SingBar_Front; Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar; - // load positions from theme + //Load Positions from Theme - // player 1: + // Player1: AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score); AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore); AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore); - // player 2: + // Player2: AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore); AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore); - // player 3: + // Player3: AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3SingBar, Theme.Sing.TextP3RScore); end; {** - * spawns a new line bonus popup for the player + * Spawns a new Line Bonus PopUp for the Player *} -procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word); -var - Cur: PScorePopUp; +Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word); +var Cur: PScorePopUp; begin if (PlayerIndex < PlayerCount) then begin - // get memory and add data + //Get Memory and Add Data GetMem(Cur, SizeOf(TScorePopUp)); - Cur.Player := PlayerIndex; + Cur.Player := PlayerIndex; Cur.TimeStamp := SDL_GetTicks; - // limit rating value to 8 - // a higher value would cause a crash when selecting the bg texture + //limit rating value to 8 + //a higher value would cause a crash when selecting the bg textur if (Rating > 8) then Cur.Rating := 8 else Cur.Rating := Rating; Cur.ScoreGiven:= 0; - if (Players[PlayerIndex].Score < Score) then + If (Players[PlayerIndex].Score < Score) then begin Cur.ScoreDiff := Score - Players[PlayerIndex].Score; aPlayers[PlayerIndex].Score := Score; @@ -431,77 +429,77 @@ begin Cur.ScoreDiff := 0; Cur.Next := nil; - // Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); + //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff)); - // add it to the chain + //Add it to the Chain if (FirstPopUp = nil) then - // the first popup in the list + //the first PopUp in the List FirstPopUp := Cur else - // second or earlier popup + //second or earlier popup LastPopUp.Next := Cur; - // set new popup to last popup in the list + //Set new Popup to Last PopUp in the List LastPopUp := Cur; end else - Log.LogError('TSingScores: Try to add popup for non-existing player'); + Log.LogError('TSingScores: Try to add PopUp for not existing player'); end; {** - * removes a popup w/o destroying the list + * Removes a PopUp w/o destroying the List *} -procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); +Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp); begin - // give player the last points that missing till now + //Give Player the Last Points that missing till now aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven; - // change bars position + //Change Bars Position if (Cur.ScoreDiff > 0) THEN - begin // popup w/ scorechange -> give missing percentille + begin //Popup w/ scorechange -> give missing Percentille aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.ScoreDiff - Cur.ScoreGiven) / Cur.ScoreDiff * (Cur.Rating / 20 - 0.26); end else - begin // popup w/o scorechange -> give complete percentille + begin //Popup w/o scorechange -> give complete Percentille aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget + (Cur.Rating / 20 - 0.26); end; - if (aPlayers[Cur.Player].RBTarget > 1) then + If (aPlayers[Cur.Player].RBTarget > 1) then aPlayers[Cur.Player].RBTarget := 1 else - if (aPlayers[Cur.Player].RBTarget < 0) then + If (aPlayers[Cur.Player].RBTarget < 0) then aPlayers[Cur.Player].RBTarget := 0; - // if this is the first popup => make next popup the first - if (Cur = FirstPopUp) then + //If this is the First PopUp => Make Next PopUp the First + If (Cur = FirstPopUp) then FirstPopUp := Cur.Next - // else => remove curent popup from chain + //Else => Remove Curent Popup from Chain else Last.Next := Cur.Next; - // if this is the last popup, make popup before the last - if (Cur = LastPopUp) then + //If this is the Last PopUp, Make PopUp before the Last + If (Cur = LastPopUp) then LastPopUp := Last; - // free the memory + //Free the Memory FreeMem(Cur, SizeOf(TScorePopUp)); end; {** - * removes all popups from mem + * Removes all PopUps from Mem *} -procedure TSingScores.KillAllPopUps; +Procedure TSingScores.KillAllPopUps; var Cur: PScorePopUp; Last: PScorePopUp; begin Cur := FirstPopUp; - // remove all popups: - while (Cur <> nil) do + //Remove all PopUps: + While (Cur <> nil) do begin Last := Cur; Cur := Cur.Next; @@ -513,42 +511,40 @@ begin end; {** - * has to be called after positions and players have been added, before first call of draw - * it gives each player a score position + * Has to be called after Positions and Players have been added, before first call of Draw + * It gives every Player a Score Position *} -procedure TSingScores.Init; +Procedure TSingScores.Init; var - PlC: array [0..1] of byte; // playercount first screen and second screen - I, J: integer; - MaxPlayersperScreen: byte; - CurPlayer: byte; - - function GetPositionCountbyPlayerCount(bPlayerCount: byte): byte; - var - I: integer; + PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen + I, J: Integer; + MaxPlayersperScreen: Byte; + CurPlayer: Byte; + + Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte; + var I: Integer; begin Result := 0; bPlayerCount := 1 shl (bPlayerCount - 1); - for I := 0 to PositionCount - 1 do + For I := 0 to PositionCount-1 do begin - if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then Inc(Result); end; end; - function GetPositionbyPlayernum(bPlayerCount, bPlayer: byte): byte; - var - I: integer; + Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte; + var I: Integer; begin bPlayerCount := 1 shl (bPlayerCount - 1); - Result := High(byte); + Result := High(Byte); - for I := 0 to PositionCount - 1 do + For I := 0 to PositionCount-1 do begin - if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then + If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then begin - if (bPlayer = 0) then + If (bPlayer = 0) then begin Result := I; Break; @@ -562,16 +558,17 @@ var begin MaxPlayersPerScreen := 0; - for I := 1 to 6 do + For I := 1 to 6 do begin - // if there are enough positions -> write to maxplayers - if (GetPositionCountbyPlayerCount(I) = I) then + //If there are enough Positions -> Write to MaxPlayers + If (GetPositionCountbyPlayerCount(I) = I) then MaxPlayersPerScreen := I else Break; end; - // split players to both screens or display on one screen + + //Split Players to both Screen or Display on One Screen if (Screens = 2) and (MaxPlayersPerScreen < PlayerCount) then begin PlC[0] := PlayerCount div 2 + PlayerCount mod 2; @@ -583,8 +580,9 @@ begin PlC[1] := 0; end; - // check if there are enough positions for all players - for I := 0 to Screens - 1 do + + //Check if there are enough Positions for all Players + For I := 0 to Screens - 1 do begin if (PlC[I] > MaxPlayersperScreen) then begin @@ -594,34 +592,34 @@ begin end; CurPlayer := 0; - // give every player a position - for I := 0 to Screens - 1 do - for J := 0 to PlC[I]-1 do + //Give every Player a Position + For I := 0 to Screens - 1 do + For J := 0 to PlC[I]-1 do begin - aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) or (I shl 7); - // Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); + aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7); + //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position)); Inc(CurPlayer); end; end; {** - * draws scores and linebonus popups + * Draws Scores and Linebonus PopUps *} -procedure TSingScores.Draw; +Procedure TSingScores.Draw; var - I: integer; - CurTime: cardinal; + I: Integer; + CurTime: Cardinal; CurPopUp, LastPopUp: PScorePopUp; begin CurTime := SDL_GetTicks; - if Visible then + If Visible then begin - // draw popups + //Draw Popups LastPopUp := nil; CurPopUp := FirstPopUp; - while (CurPopUp <> nil) do + While (CurPopUp <> nil) do begin if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then begin @@ -640,64 +638,64 @@ begin end; - if (RBVisible) then - // draw players w/ rating bar - for I := 0 to PlayerCount-1 do + IF (RBVisible) then + //Draw Players w/ Rating Bar + For I := 0 to PlayerCount-1 do begin DrawScore(I); DrawRatingBar(I); end else - // draw players w/o rating bar - for I := 0 to PlayerCount-1 do + //Draw Players w/o Rating Bar + For I := 0 to PlayerCount-1 do begin DrawScore(I); end; - end; // eo visible + end; //eo Visible end; {** - * draws a popup by pointer + * Draws a Popup by Pointer *} -procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); +Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp); var - Progress: real; - CurTime: cardinal; - X, Y, W, H, Alpha: real; - FontSize: real; - FontOffset: real; - TimeDiff: cardinal; - PIndex: byte; - TextLen: real; - ScoretoAdd: word; - PosDiff: real; + Progress: Real; + CurTime: Cardinal; + X, Y, W, H, Alpha: Real; + FontSize: integer; + FontOffset: Real; + TimeDiff: Cardinal; + PIndex: Byte; + TextLen: Real; + ScoretoAdd: Word; + PosDiff: Real; begin if (PopUp <> nil) then begin - // only draw if player has a position + //Only Draw if Player has a Position PIndex := Players[PopUp.Player].Position; - if PIndex <> High(byte) then + If PIndex <> high(byte) then begin - // only draw if player is on cur screen - if ((Players[PopUp.Player].Position and 128) = 0) = (ScreenAct = 1) then + //Only Draw if Player is on Cur Screen + If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then begin CurTime := SDL_GetTicks; - if not (Enabled and Players[PopUp.Player].Enabled) then - // increase timestamp with tiem where there is no movement ... + If Not (Enabled AND Players[PopUp.Player].Enabled) then + //Increase Timestamp with TIem where there is no Movement ... begin - // Inc(PopUp.TimeStamp, LastRender); + //Inc(PopUp.TimeStamp, LastRender); end; TimeDiff := CurTime - PopUp.TimeStamp; - // get position of popup - PIndex := PIndex and 127; + //Get Position of PopUp + PIndex := PIndex AND 127; - // check for phase ... - if (TimeDiff <= Settings.Phase1Time) then + //Check for Phase ... + If (TimeDiff <= Settings.Phase1Time) then begin - // phase 1 - the ploping up + //Phase 1 - The Ploping up Progress := TimeDiff / Settings.Phase1Time; @@ -707,26 +705,26 @@ begin X := Positions[PIndex].PUStartX + (Positions[PIndex].PUW - W)/2; Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2; - FontSize := Progress * Positions[PIndex].PUFontSize; - FontOffset := (H - FontSize) / 2; + FontSize := Round(Progress * Positions[PIndex].PUFontSize); + FontOffset := (H - FontSize) / 2; Alpha := 1; end - else if (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then + Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then begin - // phase 2 - the moving + //Phase 2 - The Moving Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time; W := Positions[PIndex].PUW; H := Positions[PIndex].PUH; PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - if PosDiff > 0 then + If PosDiff > 0 then PosDiff := PosDiff + W; X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress); PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - if PosDiff < 0 then + If PosDiff < 0 then PosDiff := PosDiff + Positions[PIndex].BGH; Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress); @@ -737,67 +735,65 @@ begin else begin - // phase 3 - the fading out + score adding + //Phase 3 - The Fading out + Score adding Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time; - if (PopUp.Rating > 0) then + If (PopUp.Rating > 0) then begin - // add scores if player enabled - if (Enabled and Players[PopUp.Player].Enabled) then + //Add Scores if Player Enabled + If (Enabled AND Players[PopUp.Player].Enabled) then begin ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven; Inc(PopUp.ScoreGiven, ScoreToAdd); aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd; - // change bar positions - if PopUp.ScoreDiff = 0 then - Log.LogError('TSingScores.DrawPopUp', 'PopUp.ScoreDiff is 0 and we want to divide by it. No idea how this happens.') - else - aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); - if (aPlayers[PopUp.Player].RBTarget > 1) then + //Change Bars Position + aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26); + If (aPlayers[PopUp.Player].RBTarget > 1) then aPlayers[PopUp.Player].RBTarget := 1 - else if (aPlayers[PopUp.Player].RBTarget < 0) then + else If (aPlayers[PopUp.Player].RBTarget < 0) then aPlayers[PopUp.Player].RBTarget := 0; end; - // set positions etc. - Alpha := 0.7 - 0.7 * Progress; + //Set Positions etc. + Alpha := 0.7 - 0.7 * Progress; W := Positions[PIndex].PUW; H := Positions[PIndex].PUH; PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX; - if (PosDiff > 0) then + If (PosDiff > 0) then PosDiff := W else PosDiff := 0; X := Positions[PIndex].PUTargetX + PosDiff * Progress; PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY; - if (PosDiff < 0) then + If (PosDiff < 0) then PosDiff := -Positions[PIndex].BGH else PosDiff := 0; - Y := Positions[PIndex].PUTargetY - PosDiff * (1 - Progress); + Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress); FontSize := Positions[PIndex].PUFontSize; FontOffset := (H - FontSize) / 2; end else begin - // here the effect that should be shown if a popup without score is drawn - // and or spawn with the graphicobjects etc. - // some work for blindy to do :p + //Here the Effect that Should be shown if a PopUp without Score is Drawn + //And or Spawn with the GraphicObjects etc. + //Some Work for Blindy to do :P - // atm: just let it slide in the scores just like the normal popup + //ATM: Just Let it Slide in the Scores just like the Normal PopUp Alpha := 0; end; end; - // draw popup - if (Alpha > 0) and (FontSize > 0) and (Players[PopUp.Player].Visible) then + //Draw PopUp + + if (Alpha > 0) AND (Players[PopUp.Player].Visible) then begin - // draw bg: + //Draw BG: glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -815,46 +811,45 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - // set font style and size + //Set FontStyle and Size SetFontStyle(Positions[PIndex].PUFont); - SetFontItalic(false); + SetFontItalic(False); SetFontSize(FontSize); - SetFontReflection(false, 0); - // draw text + //Draw Text TextLen := glTextWidth(Theme.Sing.LineBonusText[PopUp.Rating]); - // color and pos + //Color and Pos SetFontPos (X + (W - TextLen) / 2, Y + FontOffset); glColor4f(1, 1, 1, Alpha); - // draw + //Draw glPrint(Theme.Sing.LineBonusText[PopUp.Rating]); - end; // eo alpha check - end; // eo right screen - end; // eo player has position + end; //eo Alpha check + end; //eo Right Screen + end; //eo Player has Position end else - Log.LogError('TSingScores: Try to draw a non-existing popup'); + Log.LogError('TSingScores: Try to Draw a not existing PopUp'); end; {** - * draws a score by playerindex + * Draws a Score by Playerindex *} -procedure TSingScores.DrawScore(const Index: integer); +Procedure TSingScores.DrawScore(const Index: Integer); var Position: PScorePosition; ScoreStr: String; begin - // only draw if player has a position - if Players[Index].Position <> High(byte) then + //Only Draw if Player has a Position + If Players[Index].Position <> high(byte) then begin - // only draw if player is on cur screen - if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1)) and Players[Index].Visible then + //Only Draw if Player is on Cur Screen + If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then begin Position := @Positions[Players[Index].Position and 127]; - // draw scorebg + //Draw ScoreBG glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -872,51 +867,50 @@ begin glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - // draw score text + //Draw Score Text SetFontStyle(Position.TextFont); - SetFontItalic(false); + SetFontItalic(False); SetFontSize(Position.TextSize); SetFontPos(Position.TextX, Position.TextY); - SetFontReflection(false, 0); ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0'; - while (Length(ScoreStr) < 5) do + While (Length(ScoreStr) < 5) do ScoreStr := '0' + ScoreStr; glPrint(ScoreStr); - end; // eo right screen - end; // eo player has position + end; //eo Right Screen + end; //eo Player has Position end; -procedure TSingScores.DrawRatingBar(const Index: integer); +Procedure TSingScores.DrawRatingBar(const Index: Integer); var - Position: PScorePosition; - R, G, B: real; - Size, Diff: real; + Position: PScorePosition; + R,G,B, Size: Real; + Diff: Real; begin - // only draw if player has a position - if Players[Index].Position <> High(byte) then + //Only Draw if Player has a Position + if Players[Index].Position <> high(byte) then begin - // only draw if player is on cur screen + //Only Draw if Player is on Cur Screen if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1) and Players[index].RBVisible and Players[index].Visible) then begin Position := @Positions[Players[Index].Position and 127]; - if (Enabled and Players[Index].Enabled) then + if (Enabled AND Players[Index].Enabled) then begin - // move position if enabled + //Move Position if Enabled Diff := Players[Index].RBTarget - Players[Index].RBPos; - if (Abs(Diff) < 0.02) then + If(Abs(Diff) < 0.02) then aPlayers[Index].RBPos := aPlayers[Index].RBTarget else aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1; end; - // get colors for rating bar + //Get Colors for RatingBar if (Players[index].RBPos <= 0.22) then begin R := 1; @@ -926,7 +920,7 @@ begin else if (Players[index].RBPos <= 0.42) then begin R := 1; - G := Players[index].RBPos * 5; + G := Players[index].RBPos*5; B := 0; end else if (Players[index].RBPos <= 0.57) then @@ -937,7 +931,7 @@ begin end else if (Players[index].RBPos <= 0.77) then begin - R := 1 - (Players[index].RBPos - 0.57) * 5; + R := 1-(Players[index].RBPos-0.57)*5; G := 1; B := 0; end @@ -948,12 +942,12 @@ begin B := 0; end; - // enable all glfuncs needed + //Enable all glFuncs Needed glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - // draw rating bar bg + //Draw RatingBar BG glColor4f(1, 1, 1, 0.8); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum); @@ -971,7 +965,7 @@ begin glVertex2f(Position.RBX+Position.RBW, Position.RBY); glEnd; - // draw rating bar itself + //Draw Rating bar itself Size := Position.RBX + Position.RBW * Players[Index].RBPos; glColor4f(R, G, B, 1); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum); @@ -989,7 +983,7 @@ begin glVertex2f(Size, Position.RBY); glEnd; - // draw rating bar fg (the thing with the 3 lines to get better readability) + //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability) glColor4f(1, 1, 1, 0.6); glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum); glBegin(GL_QUADS); @@ -1006,11 +1000,11 @@ begin glVertex2f(Position.RBX + Position.RBW, Position.RBY); glEnd; - // disable all enabled glfuncs + //Disable all Enabled glFuncs glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - end; // eo Right Screen - end; // eo Player has Position + end; //eo Right Screen + end; //eo Player has Position end; end. diff --git a/unicode/src/base/USongs.pas b/unicode/src/base/USongs.pas index e1fb6ca9..852ccfc4 100644 --- a/unicode/src/base/USongs.pas +++ b/unicode/src/base/USongs.pas @@ -73,35 +73,35 @@ type ); TBPM = record - BPM: real; - StartBeat: real; + BPM: real; + StartBeat: real; end; TScore = record - Name: widestring; - Score: integer; - Length: string; + Name: widestring; + Score: integer; + Length: string; end; {$IFDEF USE_PSEUDO_THREAD} - TSongs = class(TPseudoThread) + TSongs = class( TPseudoThread ) {$ELSE} - TSongs = class(TThread) + TSongs = class( TThread ) {$ENDIF} private - fNotify, fWatch: longint; - fParseSongDirectory: boolean; - fProcessing: boolean; + fNotify, fWatch : longint; + fParseSongDirectory : boolean; + fProcessing : boolean; {$ifdef MSWINDOWS} - fDirWatch: TDirectoryWatch; + fDirWatch : TDirectoryWatch; {$endif} procedure int_LoadSongList; procedure DoDirChanged(Sender: TObject); protected procedure Execute; override; public - SongList: TList; // array of songs - Selected: integer; // selected song index + SongList : TList; // array of songs + Selected : integer; // selected song index constructor Create(); destructor Destroy(); override; @@ -112,7 +112,7 @@ type procedure BrowseXMLFiles(Dir: widestring); procedure Sort(Order: integer); function FindSongFile(Dir, Mask: widestring): widestring; - property Processing: boolean read fProcessing; + property Processing : boolean read fProcessing; end; @@ -121,24 +121,24 @@ type Selected: integer; // selected song index Order: integer; // order type (0=title) CatNumShow: integer; // Category Number being seen - CatCount: integer; // Number of Categorys + CatCount: integer; //Number of Categorys procedure SortSongs(); - procedure Refresh; // refreshes arrays by recreating them from Songs array - procedure ShowCategory(Index: integer); // expands all songs in category - procedure HideCategory(Index: integer); // hides all songs in category - procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed - procedure ShowCategoryList; // Hides all Songs And Show the List of all Categorys - function FindNextVisible(SearchFrom: integer): integer; // Find Next visible Song - function VisibleSongs: integer; // returns number of visible songs (for tabs) - function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) - - function SetFilter(FilterStr: UTF8String; Filter: TSongFilter): cardinal; + procedure Refresh; // refreshes arrays by recreating them from Songs array + procedure ShowCategory(Index: integer); // expands all songs in category + procedure HideCategory(Index: integer); // hides all songs in category + procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed + procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys + function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song + function VisibleSongs: integer; // returns number of visible songs (for tabs) + function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible) + + function SetFilter(FilterStr: UTF8String; Filter: TSongFilter): Cardinal; end; var - Songs: TSongs; // all songs - CatSongs: TCatSongs; // categorized songs + Songs: TSongs; // all songs + CatSongs: TCatSongs; // categorized songs const IN_ACCESS = $00000001; //* File was accessed */ @@ -177,7 +177,7 @@ begin // FIXME: threaded loading does not work this way. // It will just cause crashes but nothing else at the moment. -(* + (* {$ifdef MSWINDOWS} fDirWatch := TDirectoryWatch.create(nil); fDirWatch.OnChange := DoDirChanged; @@ -188,7 +188,7 @@ begin // now we can start the thread Resume(); -*) + *) // until it is fixed, simply load the song-list int_LoadSongList(); @@ -196,7 +196,7 @@ end; destructor TSongs.Destroy(); begin - FreeAndNil(SongList); + FreeAndNil( SongList ); inherited; end; @@ -207,7 +207,7 @@ end; procedure TSongs.Execute(); var - fChangeNotify: THandle; + fChangeNotify : THandle; begin {$IFDEF USE_PSEUDO_THREAD} int_LoadSongList(); @@ -241,13 +241,13 @@ begin for I := 0 to SongPaths.Count-1 do BrowseDir(SongPaths[I]); - if assigned(CatSongs) then + if assigned( CatSongs ) then CatSongs.Refresh; - if assigned(CatCovers) then + if assigned( CatCovers ) then CatCovers.Load; - //if assigned(Covers) then + //if assigned( Covers ) then // Covers.Load; if assigned(ScreenSong) then @@ -273,81 +273,81 @@ end; procedure TSongs.BrowseDir(Dir: widestring); begin - BrowseTXTFiles(Dir); - BrowseXMLFiles(Dir); + BrowseTXTFiles(Dir); + BrowseXMLFiles(Dir); end; procedure TSongs.BrowseTXTFiles(Dir: widestring); var - i: integer; - Files: TDirectoryEntryArray; - lSong: TSong; + i : integer; + Files : TDirectoryEntryArray; + lSong : TSong; begin try - Files := Platform.DirectoryFindFiles(Dir, '.txt', true) + Files := Platform.DirectoryFindFiles( Dir, '.txt', true) except Log.LogError('Couldn''t deal with directory/file: ' + Dir + ' in TSongs.BrowseTXTFiles') end; - for i := 0 to Length(Files) - 1 do + for i := 0 to Length(Files)-1 do begin if Files[i].IsDirectory then begin - BrowseTXTFiles(Dir + Files[i].Name + PathDelim); //Recursive Call + BrowseTXTFiles( Dir + Files[i].Name + PathDelim ); //Recursive Call end else begin - lSong := TSong.create(Dir + Files[i].Name); + lSong := TSong.create( Dir + Files[i].Name ); if lSong.Analyse then - SongList.add(lSong) + SongList.add( lSong ) else begin Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); - freeandnil(lSong); + freeandnil( lSong ); end; end; end; - SetLength(Files, 0); + SetLength( Files, 0); end; procedure TSongs.BrowseXMLFiles(Dir: widestring); var - i: integer; - Files: TDirectoryEntryArray; - lSong: TSong; + i : integer; + Files : TDirectoryEntryArray; + lSong : TSong; begin try - Files := Platform.DirectoryFindFiles(Dir, '.xml', true) + Files := Platform.DirectoryFindFiles( Dir, '.xml', true) except Log.LogError('Couldn''t deal with directory/file: ' + Dir + ' in TSongs.BrowseXMLFiles') end; - for i := 0 to Length(Files) - 1 do + for i := 0 to Length(Files)-1 do begin if Files[i].IsDirectory then begin - BrowseXMLFiles(Dir + Files[i].Name + PathDelim); // Recursive Call + BrowseXMLFiles( Dir + Files[i].Name + PathDelim ); //Recursive Call end else begin - lSong := TSong.create(Dir + Files[i].Name); + lSong := TSong.create( Dir + Files[i].Name ); if lSong.AnalyseXML then - SongList.add(lSong) + SongList.add( lSong ) else begin Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".'); - freeandnil(lSong); + freeandnil( lSong ); end; end; end; - SetLength(Files, 0); + SetLength( Files, 0); end; @@ -421,7 +421,7 @@ end; function TSongs.FindSongFile(Dir, Mask: widestring): widestring; var - SR: TSearchRec; // for parsing song directory + SR: TSearchRec; // for parsing song directory begin Result := ''; if FindFirst(Dir + Mask, faDirectory, SR) = 0 then @@ -490,13 +490,13 @@ var Inc(Order); CatIndex := Length(Song); SetLength(Song, CatIndex+1); - Song[CatIndex] := TSong.Create(); - Song[CatIndex].Artist := '[' + CategoryName + ']'; - Song[CatIndex].Main := true; + Song[CatIndex] := TSong.Create(); + Song[CatIndex].Artist := '[' + CategoryName + ']'; + Song[CatIndex].Main := true; Song[CatIndex].OrderTyp := 0; Song[CatIndex].OrderNum := Order; - Song[CatIndex].Cover := CatCovers.GetCover(Ini.Sorting, CategoryName); - Song[CatIndex].Visible := true; + Song[CatIndex].Cover := CatCovers.GetCover(Ini.Sorting, CategoryName); + Song[CatIndex].Visible := true; // set number of songs in previous category PrevCatBtnIndex := CatIndex - CatNumber - 1; @@ -507,21 +507,21 @@ var end; begin - CatNumShow := -1; + CatNumShow := -1; SortSongs(); CurCategory := ''; - Order := 0; - CatNumber := 0; + Order := 0; + CatNumber := 0; // Note: do NOT set Letter to ' ', otherwise no category-button will be // created for songs beginning with ' ' if songs of this category exist. // TODO: trim song-properties so ' ' will not occur as first chararcter. - Letter := 0; + Letter := 0; // clear song-list - for SongIndex := 0 to Songs.SongList.Count - 1 do + for SongIndex := 0 to Songs.SongList.Count-1 do begin // free category buttons // Note: do NOT delete songs, they are just references to Songs.SongList entries @@ -531,7 +531,7 @@ begin end; SetLength(Song, 0); - for SongIndex := 0 to Songs.SongList.Count - 1 do + for SongIndex := 0 to Songs.SongList.Count-1 do begin CurSong := TSong(Songs.SongList[SongIndex]); // if tabs are on, add section buttons for each new section @@ -545,11 +545,11 @@ begin // TODO: remove this block if it is not needed anymore { - if CurSection = 'Singstar Part 2' then CoverName := 'Singstar'; - if CurSection = 'Singstar German' then CoverName := 'Singstar'; - if CurSection = 'Singstar Spanish' then CoverName := 'Singstar'; - if CurSection = 'Singstar Italian' then CoverName := 'Singstar'; - if CurSection = 'Singstar French' then CoverName := 'Singstar'; + if CurSection = 'Singstar Part 2' then CoverName := 'Singstar'; + if CurSection = 'Singstar German' then CoverName := 'Singstar'; + if CurSection = 'Singstar Spanish' then CoverName := 'Singstar'; + if CurSection = 'Singstar Italian' then CoverName := 'Singstar'; + if CurSection = 'Singstar French' then CoverName := 'Singstar'; if CurSection = 'Singstar 80s Polish' then CoverName := 'Singstar 80s'; } @@ -668,14 +668,15 @@ begin CurSong.Visible := true else if (Ini.Tabs = 1) then CurSong.Visible := false; -{ + + { if (Ini.Tabs = 1) and (Order = 1) then begin //open first tab CurSong.Visible := true; end; CurSong.Visible := true; -} + } end; // set CatNumber of last category @@ -693,7 +694,7 @@ end; procedure TCatSongs.ShowCategory(Index: integer); var - S: integer; // song + S: integer; // song begin CatNumShow := Index; for S := 0 to high(CatSongs.Song) do @@ -705,13 +706,13 @@ begin CatSongs.Song[S].Visible := false; } // KMS: This should be the same, but who knows :-) - CatSongs.Song[S].Visible := ((CatSongs.Song[S].OrderNum = Index) and (not CatSongs.Song[S].Main)); + CatSongs.Song[S].Visible := ( (CatSongs.Song[S].OrderNum = Index) and (not CatSongs.Song[S].Main) ); end; end; procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category var - S: integer; // song + S: integer; // song begin for S := 0 to high(CatSongs.Song) do begin @@ -722,7 +723,7 @@ end; procedure TCatSongs.ClickCategoryButton(Index: integer); var - Num: integer; + Num: integer; begin Num := CatSongs.Song[Index].OrderNum; if Num <> CatNumShow then @@ -738,7 +739,7 @@ end; //Hide Categorys when in Category Hack procedure TCatSongs.ShowCategoryList; var - S: integer; + S: integer; begin // Hide All Songs Show All Cats for S := 0 to high(CatSongs.Song) do @@ -748,8 +749,8 @@ begin end; //Hide Categorys when in Category Hack End -// Wrong song selected when tabs on bug -function TCatSongs.FindNextVisible(SearchFrom:integer): integer;// Find next Visible Song +//Wrong song selected when tabs on bug +function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song var I: integer; begin @@ -760,11 +761,11 @@ begin Inc (I); if (I>high(CatSongs.Song)) then I := low(CatSongs.Song); - if (I = SearchFrom) then // Make One Round and no song found->quit + if (I = SearchFrom) then //Make One Round and no song found->quit break; end; end; -// Wrong song selected when tabs on bug End +//Wrong song selected when tabs on bug End (** * Returns the number of visible songs. @@ -790,20 +791,19 @@ var SongIndex: integer; begin Result := 0; - for SongIndex := 0 to Index - 1 do + for SongIndex := 0 to Index-1 do begin if (CatSongs.Song[SongIndex].Visible) then Inc(Result); end; end; -function TCatSongs.SetFilter(FilterStr: UTF8String; Filter: TSongFilter): cardinal; +function TCatSongs.SetFilter(FilterStr: UTF8String; Filter: TSongFilter): Cardinal; var - I, J: integer; + I, J: integer; TmpString: UTF8String; WordArray: array of UTF8String; begin - FilterStr := Trim(FilterStr); if (FilterStr <> '') then begin @@ -838,7 +838,7 @@ begin fltArtist: TmpString := Song[I].Artist; end; - Song[i].Visible:=true; + Song[i].Visible:=True; // Look for every Searched Word for J := 0 to High(WordArray) do begin @@ -849,7 +849,7 @@ begin Inc(Result); end else - Song[i].Visible := false; + Song[i].Visible := False; end; CatNumShow := -2; end diff --git a/unicode/src/base/UTexture.pas b/unicode/src/base/UTexture.pas index 97f244fe..962bd2b0 100644 --- a/unicode/src/base/UTexture.pas +++ b/unicode/src/base/UTexture.pas @@ -336,8 +336,8 @@ begin X := 0; Y := 0; Z := 0; - W := oldWidth; - H := oldHeight; + W := 0; + H := 0; ScaleW := 1; ScaleH := 1; Rot := 0; diff --git a/unicode/src/base/UThemes.pas b/unicode/src/base/UThemes.pas index 3fd77853..9bf858ed 100644 --- a/unicode/src/base/UThemes.pas +++ b/unicode/src/base/UThemes.pas @@ -42,13 +42,13 @@ uses type TRGB = record - R: single; - G: single; - B: single; + R: single; + G: single; + B: single; end; TRGBA = record - R, G, B, A: double; + R, G, B, A: Double; end; type @@ -175,12 +175,11 @@ type W: integer; H: integer; Z: real; - SBGW: integer; TextSize: integer; - showArrows:boolean; - oneItemOnly:boolean; + //SBGW Mod + SBGW: integer; Text: string; ColR, ColG, ColB, Int: real; @@ -360,11 +359,6 @@ type PausePopUp: TThemeStatic; end; - TThemeLyricBar = record - IndicatorYOffset, UpperX, UpperW, UpperY, UpperH, - LowerX, LowerW, LowerY, LowerH : integer; - end; - TThemeScore = class(TThemeBasic) TextArtist: TThemeText; TextTitle: TThemeText; @@ -729,7 +723,6 @@ type Level: TThemeLevel; Song: TThemeSong; Sing: TThemeSing; - LyricBar: TThemeLyricBar; Score: TThemeScore; Top5: TThemeTop5; Options: TThemeOptions; @@ -1038,19 +1031,9 @@ begin ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5'); - //LyricBar asd - LyricBar.UpperX := ThemeIni.ReadInteger('SingLyricsUpperBar', 'X', 0); - LyricBar.UpperW := ThemeIni.ReadInteger('SingLyricsUpperBar', 'W', 0); - LyricBar.UpperY := ThemeIni.ReadInteger('SingLyricsUpperBar', 'Y', 0); - LyricBar.UpperH := ThemeIni.ReadInteger('SingLyricsUpperBar', 'H', 0); - LyricBar.IndicatorYOffset := ThemeIni.ReadInteger('SingLyricsUpperBar', 'IndicatorYOffset', 0); - LyricBar.LowerX := ThemeIni.ReadInteger('SingLyricsLowerBar', 'X', 0); - LyricBar.LowerW := ThemeIni.ReadInteger('SingLyricsLowerBar', 'W', 0); - LyricBar.LowerY := ThemeIni.ReadInteger('SingLyricsLowerBar', 'Y', 0); - LyricBar.LowerH := ThemeIni.ReadInteger('SingLyricsLowerBar', 'H', 0); - // Sing ThemeLoadBasic(Sing, 'Sing'); + //TimeBar mod ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress'); ThemeLoadText(Sing.TextTimeText, 'SingTimeText'); @@ -1786,7 +1769,7 @@ begin ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0); - ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400); + ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450); LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', '')); ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1); diff --git a/unicode/src/base/UTime.pas b/unicode/src/base/UTime.pas index 83844cb5..3f35dffd 100644 --- a/unicode/src/base/UTime.pas +++ b/unicode/src/base/UTime.pas @@ -61,20 +61,20 @@ procedure CountSkipTime; procedure CountMidTime; var - USTime: TTime; + USTime : TTime; VideoBGTimer: TRelativeTimer; - TimeNew: int64; - TimeOld: int64; - TimeSkip: real; - TimeMid: real; - TimeMidTemp: int64; + TimeNew : int64; + TimeOld : int64; + TimeSkip : real; + TimeMid : real; + TimeMidTemp : int64; implementation uses sdl, - UCommon; + ucommon; const cSDLCorrectionRatio = 1000; @@ -91,14 +91,14 @@ http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE procedure CountSkipTimeSet; begin - TimeNew := SDL_GetTicks(); + TimeNew := SDL_GetTicks(); end; procedure CountSkipTime; begin - TimeOld := TimeNew; - TimeNew := SDL_GetTicks(); - TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; + TimeOld := TimeNew; + TimeNew := SDL_GetTicks(); + TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio; end; procedure CountMidTime; @@ -127,10 +127,10 @@ end; **} (* - * creates a new timer. - * if triggermode is false (default), the timer + * Creates a new timer. + * If TriggerMode is false (default), the timer * will immediately begin with counting. - * if triggermode is true, it will wait until get/settime() or pause() is called + * If TriggerMode is true, it will wait until Get/SetTime() or Pause() is called * for the first time. *) constructor TRelativeTimer.Create(TriggerMode: boolean); diff --git a/unicode/src/lib/ffmpeg/avcodec.pas b/unicode/src/lib/ffmpeg/avcodec.pas index ceb1b7f0..6039835c 100644 --- a/unicode/src/lib/ffmpeg/avcodec.pas +++ b/unicode/src/lib/ffmpeg/avcodec.pas @@ -29,11 +29,6 @@ * Min. version: 51.16.0, revision 6577, Sat Oct 7 15:30:46 2006 UTC * Max. version: 52.11.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC *) -{ - * update to - * Max. version: 52.31.2, Sar Jun 13 22:05:00 2009 UTC - * MiSchi -} unit avcodec; @@ -65,8 +60,8 @@ uses const (* Max. supported version by this header *) LIBAVCODEC_MAX_VERSION_MAJOR = 52; - LIBAVCODEC_MAX_VERSION_MINOR = 31; - LIBAVCODEC_MAX_VERSION_RELEASE = 2; + LIBAVCODEC_MAX_VERSION_MINOR = 11; + LIBAVCODEC_MAX_VERSION_RELEASE = 0; LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) + (LIBAVCODEC_MAX_VERSION_RELEASE * VERSION_RELEASE); @@ -90,9 +85,9 @@ const {$IFEND} const - AV_NOPTS_VALUE: cint64 = $8000000000000000; + AV_NOPTS_VALUE: cint64 = $8000000000000000; AV_TIME_BASE = 1000000; - AV_TIME_BASE_Q: TAVRational = (num: 1; den: AV_TIME_BASE); + AV_TIME_BASE_Q : TAVRational = (num: 1; den: AV_TIME_BASE); (** * Identifies the syntax and semantics of the bitstream. @@ -238,28 +233,6 @@ type CODEC_ID_MOTIONPIXELS, CODEC_ID_TGV, CODEC_ID_TGQ, -{$IF LIBAVCODEC_VERSION >= 52012000} // >= 52.12.0 - CODEC_ID_TQI, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52022002} // >= 52.22.2 - CODEC_ID_AURA, - CODEC_ID_AURA2, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52027000} // >= 52.27.0 - CODEC_ID_V210X, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 - CODEC_ID_TMV, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52029000} // >= 52.29.0 - CODEC_ID_V210, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52030002} // >= 52.30.2 - CODEC_ID_DPX, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52031002} // >= 52.31.2 - CODEC_ID_MAD, -{$IFEND} //* various PCM "codecs" */ CODEC_ID_PCM_S16LE= $10000, @@ -335,7 +308,7 @@ type CODEC_ID_MP2= $15000, CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 CODEC_ID_AAC, - {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 _CODEC_ID_MPEG4AAC, // will be redefined to CODEC_ID_AAC below {$IFEND} CODEC_ID_AC3, @@ -381,15 +354,6 @@ type CODEC_ID_EAC3, CODEC_ID_SIPR, CODEC_ID_MP1, -{$IF LIBAVCODEC_VERSION >= 52020000} // >= 52.20.0 - CODEC_ID_TWINVQ, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52022000} // >= 52.22.0 - CODEC_ID_TRUEHD, -{$IFEND} -{$IF LIBAVCODEC_VERSION >= 52026000} // >= 52.26.0 - CODEC_ID_MP4ALS, -{$IFEND} //* subtitle codecs */ CODEC_ID_DVD_SUBTITLE= $17000, @@ -405,11 +369,11 @@ type CODEC_ID_PROBE= $19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it CODEC_ID_MPEG2TS= $20000, {*< _FAKE_ codec to indicate a raw MPEG-2 TS - * stream (only used by libavformat) *} + * stream (only used by libavformat) *} __CODEC_ID_4BYTE = $FFFFF // ensure 4-byte enum ); -{$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 +{$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 {* CODEC_ID_MP3LAME is obsolete *} const CODEC_ID_MP3LAME = CODEC_ID_MP3; @@ -443,7 +407,7 @@ type _TSampleFormatArray = array [0 .. MaxInt div SizeOf(TSampleFormat)-1] of TSampleFormat; PSampleFormatArray = ^_TSampleFormatArray; -const +const {* Audio channel masks *} CH_FRONT_LEFT = $00000001; CH_FRONT_RIGHT = $00000002; @@ -470,28 +434,13 @@ const CH_LAYOUT_MONO = (CH_FRONT_CENTER); CH_LAYOUT_STEREO = (CH_FRONT_LEFT or CH_FRONT_RIGHT); CH_LAYOUT_SURROUND = (CH_LAYOUT_STEREO or CH_FRONT_CENTER); -{$IF LIBAVCODEC_VERSION >= 52027000} // >= 52.27.0 - CH_LAYOUT_2_1 = (CH_LAYOUT_STEREO or CH_BACK_CENTER); - CH_LAYOUT_4POINT0 = (CH_LAYOUT_SURROUND or CH_BACK_CENTER); - CH_LAYOUT_2_2 = (CH_LAYOUT_STEREO or CH_SIDE_LEFT or CH_SIDE_RIGHT); -{$IFEND} CH_LAYOUT_QUAD = (CH_LAYOUT_STEREO or CH_BACK_LEFT or CH_BACK_RIGHT); CH_LAYOUT_5POINT0 = (CH_LAYOUT_SURROUND or CH_SIDE_LEFT or CH_SIDE_RIGHT); CH_LAYOUT_5POINT1 = (CH_LAYOUT_5POINT0 or CH_LOW_FREQUENCY); -{$IF LIBAVCODEC_VERSION >= 52025000} // >= 52.25.0 - CH_LAYOUT_5POINT0_BACK = (CH_LAYOUT_SURROUND or CH_BACK_LEFT or - CH_BACK_RIGHT); - CH_LAYOUT_5POINT1_BACK = (CH_LAYOUT_5POINT0_BACK or CH_LOW_FREQUENCY); -{$IFEND} CH_LAYOUT_7POINT1 = (CH_LAYOUT_5POINT1 or CH_BACK_LEFT or CH_BACK_RIGHT); -{$IF LIBAVCODEC_VERSION < 52025000} // < 52.25.0 CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_SURROUND or CH_LOW_FREQUENCY or - CH_BACK_LEFT or CH_BACK_RIGHT or -{$ELSE} - CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_5POINT1_BACK or -{$IFEND} - CH_FRONT_LEFT_OF_CENTER or - CH_FRONT_RIGHT_OF_CENTER); + CH_BACK_LEFT or CH_BACK_RIGHT or + CH_FRONT_LEFT_OF_CENTER or CH_FRONT_RIGHT_OF_CENTER); CH_LAYOUT_STEREO_DOWNMIX = (CH_STEREO_LEFT or CH_STEREO_RIGHT); @@ -533,76 +482,20 @@ type TAVDiscard = ( {* We leave some space between them for extensions (drop some - * keyframes for intra-only or drop just some bidir frames). - *} - AVDISCARD_NONE = -16, ///< discard nothing - AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi - AVDISCARD_NONREF = 8, ///< discard all non reference - AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames - AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes - AVDISCARD_ALL = 48 ///< discard all - ); - -{$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 - TAVColorPrimaries = ( - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B - AVCOL_PRI_UNSPECIFIED = 2, - AVCOL_PRI_BT470M = 4, - AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM - AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above - AVCOL_PRI_FILM = 8, - AVCOL_PRI_NB ///< Not part of ABI - ); - - TAVColorTransferCharacteristic = ( - AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 - AVCOL_TRC_UNSPECIFIED = 2, - AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM - AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG - AVCOL_TRC_NB ///< Not part of ABI - ); - - TAVColorSpace = ( - AVCOL_SPC_RGB = 0, - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B - AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_FCC = 4, - AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above - AVCOL_SPC_SMPTE240M = 7, - AVCOL_SPC_NB ///< Not part of ABI + * keyframes for intra-only or drop just some bidir frames). *} + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT= 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48 ///< discard all ); - TAVColorRange = ( - AVCOL_RANGE_UNSPECIFIED = 0, - AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges - AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges - AVCOL_RANGE_NB ///< Not part of ABI - ); - -(** - * X X 3 4 X X are luma samples, - * 1 2 1-6 are possible chroma positions - * X X 5 6 X 0 is undefined/unknown position - *) - TAVChromaLocation = ( - AVCHROMA_LOC_UNSPECIFIED = 0, - AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default - AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 - AVCHROMA_LOC_TOPLEFT = 3, ///< DV - AVCHROMA_LOC_TOP = 4, - AVCHROMA_LOC_BOTTOMLEFT = 5, - AVCHROMA_LOC_BOTTOM = 6, - AVCHROMA_LOC_NB ///< Not part of ABI - ); -{$IFEND} - PRcOverride = ^TRcOverride; TRcOverride = record {16} - start_frame: cint; - end_frame: cint; - qscale: cint; // if this is 0 then quality_factor will be used instead + start_frame: cint; + end_frame: cint; + qscale: cint; // if this is 0 then quality_factor will be used instead quality_factor: cfloat; end; @@ -762,8 +655,8 @@ type end; const - FF_QSCALE_TYPE_MPEG1 = 0; - FF_QSCALE_TYPE_MPEG2 = 1; + FF_QSCALE_TYPE_MPEG1 = 0; + FF_QSCALE_TYPE_MPEG2 = 1; FF_QSCALE_TYPE_H264 = 2; FF_BUFFER_TYPE_INTERNAL = 1; @@ -785,311 +678,7 @@ const FF_BUFFER_HINTS_PRESERVE = $04; // User must not alter buffer content FF_BUFFER_HINTS_REUSABLE = $08; // Codec will reuse the buffer (update) -const - {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 - DEFAULT_FRAME_RATE_BASE = 1001000; - {$IFEND} - - FF_ASPECT_EXTENDED = 15; - - FF_RC_STRATEGY_XVID = 1; - - FF_BUG_AUTODETECT = 1; ///< autodetection - FF_BUG_OLD_MSMPEG4 = 2; - FF_BUG_XVID_ILACE = 4; - FF_BUG_UMP4 = 8; - FF_BUG_NO_PADDING = 16; - FF_BUG_AMV = 32; - FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default - FF_BUG_QPEL_CHROMA = 64; - FF_BUG_STD_QPEL = 128; - FF_BUG_QPEL_CHROMA2 = 256; - FF_BUG_DIRECT_BLOCKSIZE = 512; - FF_BUG_EDGE = 1024; - FF_BUG_HPEL_CHROMA = 2048; - FF_BUG_DC_CLIP = 4096; - FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders - //FF_BUG_FAKE_SCALABILITY = 16 //Autodetection should work 100%. - - FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software - FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences - FF_COMPLIANCE_NORMAL = 0; - FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions - FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things - - FF_ER_CAREFUL = 1; - FF_ER_COMPLIANT = 2; - FF_ER_AGGRESSIVE = 3; - FF_ER_VERY_AGGRESSIVE = 4; - - FF_DCT_AUTO = 0; - FF_DCT_FASTINT = 1; - FF_DCT_INT = 2; - FF_DCT_MMX = 3; - FF_DCT_MLIB = 4; - FF_DCT_ALTIVEC = 5; - FF_DCT_FAAN = 6; - - FF_IDCT_AUTO = 0; - FF_IDCT_INT = 1; - FF_IDCT_SIMPLE = 2; - FF_IDCT_SIMPLEMMX = 3; - FF_IDCT_LIBMPEG2MMX = 4; - FF_IDCT_PS2 = 5; - FF_IDCT_MLIB = 6; - FF_IDCT_ARM = 7; - FF_IDCT_ALTIVEC = 8; - FF_IDCT_SH4 = 9; - FF_IDCT_SIMPLEARM = 10; - FF_IDCT_H264 = 11; - FF_IDCT_VP3 = 12; - FF_IDCT_IPP = 13; - FF_IDCT_XVIDMMX = 14; - FF_IDCT_CAVS = 15; - FF_IDCT_SIMPLEARMV5TE= 16; - FF_IDCT_SIMPLEARMV6 = 17; - FF_IDCT_SIMPLEVIS = 18; - FF_IDCT_WMV2 = 19; - FF_IDCT_FAAN = 20; - FF_IDCT_EA = 21; - FF_IDCT_SIMPLENEON = 22; - FF_IDCT_SIMPLEALPHA = 23; - - FF_EC_GUESS_MVS = 1; - FF_EC_DEBLOCK = 2; - - FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) - (* lower 16 bits - CPU features *) - FF_MM_MMX = $0001; ///< standard MMX - FF_MM_3DNOW = $0004; ///< AMD 3DNOW - {$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} - FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52024000} // >= 52.24.0 - FF_MM_MMX2 = $0002; ///< SSE integer functions or AMD MMX ext - {$IFEND} - FF_MM_SSE = $0008; ///< SSE functions - FF_MM_SSE2 = $0010; ///< PIV SSE2 functions - FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt - FF_MM_SSE3 = $0040; ///< Prescott SSE3 functions - FF_MM_SSSE3 = $0080; ///< Conroe SSSE3 functions - {$IF LIBAVCODEC_VERSION >= 52022003} // >= 52.22.3 - FF_MM_SSE4 = $0100; ///< Penryn SSE4.1 functions - FF_MM_SSE42 = $0200; ///< Nehalem SSE4.2 functions - {$IFEND} - FF_MM_IWMMXT = $0100; ///< XScale IWMMXT - FF_MM_ALTIVEC = $0001; ///< standard AltiVec - - FF_PRED_LEFT = 0; - FF_PRED_PLANE = 1; - FF_PRED_MEDIAN = 2; - - FF_DEBUG_PICT_INFO = 1; - FF_DEBUG_RC = 2; - FF_DEBUG_BITSTREAM = 4; - FF_DEBUG_MB_TYPE = 8; - FF_DEBUG_QP = 16; - FF_DEBUG_MV = 32; - FF_DEBUG_DCT_COEFF = $00000040; - FF_DEBUG_SKIP = $00000080; - FF_DEBUG_STARTCODE = $00000100; - FF_DEBUG_PTS = $00000200; - FF_DEBUG_ER = $00000400; - FF_DEBUG_MMCO = $00000800; - FF_DEBUG_BUGS = $00001000; - FF_DEBUG_VIS_QP = $00002000; - FF_DEBUG_VIS_MB_TYPE = $00004000; - FF_DEBUG_BUFFERS = $00008000; - - FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames - FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames - FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames - - FF_CMP_SAD = 0; - FF_CMP_SSE = 1; - FF_CMP_SATD = 2; - FF_CMP_DCT = 3; - FF_CMP_PSNR = 4; - FF_CMP_BIT = 5; - FF_CMP_RD = 6; - FF_CMP_ZERO = 7; - FF_CMP_VSAD = 8; - FF_CMP_VSSE = 9; - FF_CMP_NSSE = 10; - FF_CMP_W53 = 11; - FF_CMP_W97 = 12; - FF_CMP_DCTMAX = 13; - FF_CMP_DCT264 = 14; - FF_CMP_CHROMA = 256; - - FF_DTG_AFD_SAME = 8; - FF_DTG_AFD_4_3 = 9; - FF_DTG_AFD_16_9 = 10; - FF_DTG_AFD_14_9 = 11; - FF_DTG_AFD_4_3_SP_14_9 = 13; - FF_DTG_AFD_16_9_SP_14_9 = 14; - FF_DTG_AFD_SP_4_3 = 15; - - FF_DEFAULT_QUANT_BIAS = 999999; - - FF_LAMBDA_SHIFT = 7; - FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); - FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda - FF_LAMBDA_MAX = (256 * 128 - 1); - - FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove - - FF_CODER_TYPE_VLC = 0; - FF_CODER_TYPE_AC = 1; - FF_CODER_TYPE_RAW = 2; - FF_CODER_TYPE_RLE = 3; - FF_CODER_TYPE_DEFLATE = 4; - - SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display - SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) - SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) - - FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp - FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits - FF_MB_DECISION_RD = 2; ///< rate distortion - - FF_AA_AUTO = 0; - FF_AA_FASTINT = 1; //not implemented yet - FF_AA_INT = 2; - FF_AA_FLOAT = 3; - - FF_PROFILE_UNKNOWN = -99; - FF_PROFILE_AAC_MAIN = 0; - FF_PROFILE_AAC_LOW = 1; - FF_PROFILE_AAC_SSR = 2; - FF_PROFILE_AAC_LTP = 3; - - FF_LEVEL_UNKNOWN = -99; - - X264_PART_I4X4 = $001; (* Analyse i4x4 *) - X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) - X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) - X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) - X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) - - FF_COMPRESSION_DEFAULT = -1; - -const - AVPALETTE_SIZE = 1024; - AVPALETTE_COUNT = 256; - -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} -type -(** - * AVPaletteControl - * This structure defines a method for communicating palette changes - * between and demuxer and a decoder. - * - * @deprecated Use AVPacket to send palette changes instead. - * This is totally broken. - *) - PAVPaletteControl = ^TAVPaletteControl; - TAVPaletteControl = record - (* demuxer sets this to 1 to indicate the palette has changed; - * decoder resets to 0 *) - palette_changed: cint; - - (* 4-byte ARGB palette entries, stored in native byte order; note that - * the individual palette components should be on a 8-bit scale; if - * the palette data comes from a IBM VGA native format, the component - * data is probably 6 bits in size and needs to be scaled *) - palette: array [0..AVPALETTE_COUNT - 1] of cuint; - end; {deprecated;} -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52023000} // >= 52.23.0 -type - PAVPacket = ^TAVPacket; - TAVPacket = record -(* - * Presentation timestamp in AVStream->time_base units; the time at which - * the decompressed packet will be presented to the user. - * Can be AV_NOPTS_VALUE if it is not stored in the file. - * pts MUST be larger or equal to dts as presentation cannot happen before - * decompression, unless one wants to view hex dumps. Some formats misuse - * the terms dts and pts/cts to mean something different. Such timestamps - * must be converted to true pts/dts before they are stored in AVPacket. - *) - pts: cint64; -(* - * Decompression timestamp in AVStream->time_base units; the time at which - * the packet is decompressed. - * Can be AV_NOPTS_VALUE if it is not stored in the file. - *) - dts: cint64; - data: PByteArray; - size: cint; - stream_index: cint; - flags: cint; -(* - * Duration of this packet in AVStream->time_base units, 0 if unknown. - * Equals next_pts - this_pts in presentation order. - *) - duration: cint; - destruct: procedure (para1: PAVPacket); cdecl; - priv: pointer; - pos: cint64; // byte position in stream, -1 if unknown - -(* - * Time difference in AVStream->time_base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current packet. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. - *) - convergence_duration: cint64; - end; - -const - {$IF LIBAVCODEC_VERSION >= 52030002} // >= 52.30.2 - PKT_FLAG_KEY = $0001; - {$ELSE} - AV_PKT_FLAG_KEY = $0001; - {$IF LIBAVCODEC_VERSION_MAJOR < 53} - PKT_FLAG_KEY = AV_PKT_FLAG_KEY; - {$IFEND} - {$IFEND} -{$IFEND} - type - PAVClass = ^TAVClass; {const} - PAVCodecContext = ^TAVCodecContext; - - PAVCodec = ^TAVCodec; - -{$IF LIBAVCODEC_VERSION >= 52018000} // >= 52.18.0 - PAVHWAccel = ^TAVHWAccel; -{$IFEND} - - // int[4] - PQuadIntArray = ^TQuadIntArray; - TQuadIntArray = array[0..3] of cint; - // int (*func)(struct AVCodecContext *c2, void *arg) - TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; - - TAVClass = record - class_name: PAnsiChar; - (* actually passing a pointer to an AVCodecContext - or AVFormatContext, which begin with an AVClass. - Needed because av_log is in libavcodec and has no visibility - of AVIn/OutputFormat *) - item_name: function(): PAnsiChar; cdecl; - option: PAVOption; - end; - {** * Audio Video Frame. * New fields can be added to the end of FF_COMMON_FRAME with minor version @@ -1135,7 +724,7 @@ type * - decoding: Set by libavcodec. *) pts: cint64; - (** + (**\ * picture number in bitstream order * - encoding: set by * - decoding: Set by libavcodec. @@ -1164,7 +753,6 @@ type * is this picture used as reference * The values for this are the same as the MpegEncContext.picture_structure * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. - * Set to 4 for delayed, non-reference frames. * - encoding: unused * - decoding: Set by libavcodec. (before get_buffer() call)). *) @@ -1289,7 +877,7 @@ type *) ref_index: array [0..1] of PShortint; - {$IF LIBAVCODEC_VERSION >= 51068000} // >= 51.68.0 + {$IF LIBAVCODEC_VERSION >= 51068000} // 51.68.0 (** * reordered opaque 64bit number (generally a PTS) from AVCodecContext.reordered_opaque * output in AVFrame.reordered_opaque @@ -1298,20 +886,8 @@ type *) reordered_opaque: cint64; {$IFEND} - - {$IF LIBAVCODEC_VERSION = 52021000} // = 52.21.0 - (** - * hardware accelerator private data (FFmpeg allocated) - * - encoding: unused - * - decoding: Set by libavcodec - *) - hwaccel_data_private: pointer; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52022000} // >= 52.22.0 - hwaccel_picture_private: pointer; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 51070000} // >= 51.70.0 + {$IF LIBAVCODEC_VERSION >= 51070000} // 51.70.0 (** * Bits per sample/pixel of internal libavcodec pixel/sample format. * This field is applicable only when sample_fmt is SAMPLE_FMT_S32. @@ -1321,7 +897,7 @@ type bits_per_raw_sample: cint; {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52002000} // >= 52.2.0 + {$IF LIBAVCODEC_VERSION >= 52002000} // 52.2.0 (** * Audio channel layout. * - encoding: set by user. @@ -1337,7 +913,7 @@ type request_channel_layout: cint64; {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52004000} // >= 52.4.0 + {$IF LIBAVCODEC_VERSION >= 52004000} // 52.4.0 (** * Ratecontrol attempt to use, at maximum, <value> of what can be used without an underflow. * - encoding: Set by user. @@ -1352,73 +928,234 @@ type *) rc_min_vbv_overflow_use: cfloat; {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52018000} // >= 52.18.0 - (** - * Hardware accelerator in use - * - encoding: unused. - * - decoding: Set by libavcodec - *) - hwaccel: PAVHWAccel; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52020000} // >= 52.20.0 - (** - * For some codecs, the time base is closer to the field rate than the frame rate. - * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration - * if no telecine is used ... - * - * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. - *) - ticks_per_frame: cint; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52021000} // >= 52.21.0 - (** - * Hardware accelerator context. - * For some hardware accelerators, a global context needs to be - * provided by the user. In that case, this holds display-dependent - * data FFmpeg cannot instantiate itself. Please refer to the - * FFmpeg HW accelerator documentation to know how to fill this - * is. e.g. for VA API, this is a struct vaapi_context. - * - encoding: unused - * - decoding: Set by user - *) - hwaccel_context: pointer; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52028000} // >= 52.28.0 - (** - * Chromaticity coordinates of the source primaries. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - color_primaries: TAVColorPrimaries; + end; - (** - * Color Transfer Characteristic. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - color_trc: TAVColorTransferCharacteristic; +const + {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 + DEFAULT_FRAME_RATE_BASE = 1001000; + {$IFEND} - (** - * YUV colorspace type. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - colorspace: TAVColorSpace; + FF_ASPECT_EXTENDED = 15; - (** - * MPEG vs JPEG YUV range. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - color_range: TAVColorRange; + FF_RC_STRATEGY_XVID = 1; - (** - * This defines the location of chroma samples. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - chroma_sample_location: TAVChromaLocation; - {$IFEND} + FF_BUG_AUTODETECT = 1; ///< autodetection + FF_BUG_OLD_MSMPEG4 = 2; + FF_BUG_XVID_ILACE = 4; + FF_BUG_UMP4 = 8; + FF_BUG_NO_PADDING = 16; + FF_BUG_AMV = 32; + FF_BUG_AC_VLC = 0; ///< will be removed, libavcodec can now handle these non compliant files by default + FF_BUG_QPEL_CHROMA = 64; + FF_BUG_STD_QPEL = 128; + FF_BUG_QPEL_CHROMA2 = 256; + FF_BUG_DIRECT_BLOCKSIZE = 512; + FF_BUG_EDGE = 1024; + FF_BUG_HPEL_CHROMA = 2048; + FF_BUG_DC_CLIP = 4096; + FF_BUG_MS = 8192; ///< workaround various bugs in microsofts broken decoders + //FF_BUG_FAKE_SCALABILITY = 16 //Autodetection should work 100%. + + FF_COMPLIANCE_VERY_STRICT = 2; ///< strictly conform to a older more strict version of the spec or reference software + FF_COMPLIANCE_STRICT = 1; ///< strictly conform to all the things in the spec no matter what consequences + FF_COMPLIANCE_NORMAL = 0; + FF_COMPLIANCE_INOFFICIAL = -1; ///< allow inofficial extensions + FF_COMPLIANCE_EXPERIMENTAL = -2; ///< allow non standarized experimental things + + FF_ER_CAREFUL = 1; + FF_ER_COMPLIANT = 2; + FF_ER_AGGRESSIVE = 3; + FF_ER_VERY_AGGRESSIVE = 4; + + FF_DCT_AUTO = 0; + FF_DCT_FASTINT = 1; + FF_DCT_INT = 2; + FF_DCT_MMX = 3; + FF_DCT_MLIB = 4; + FF_DCT_ALTIVEC = 5; + FF_DCT_FAAN = 6; + + FF_IDCT_AUTO = 0; + FF_IDCT_INT = 1; + FF_IDCT_SIMPLE = 2; + FF_IDCT_SIMPLEMMX = 3; + FF_IDCT_LIBMPEG2MMX = 4; + FF_IDCT_PS2 = 5; + FF_IDCT_MLIB = 6; + FF_IDCT_ARM = 7; + FF_IDCT_ALTIVEC = 8; + FF_IDCT_SH4 = 9; + FF_IDCT_SIMPLEARM = 10; + FF_IDCT_H264 = 11; + FF_IDCT_VP3 = 12; + FF_IDCT_IPP = 13; + FF_IDCT_XVIDMMX = 14; + FF_IDCT_CAVS = 15; + FF_IDCT_SIMPLEARMV5TE= 16; + FF_IDCT_SIMPLEARMV6 = 17; + FF_IDCT_SIMPLEVIS = 18; + FF_IDCT_WMV2 = 19; + FF_IDCT_FAAN = 20; + FF_IDCT_EA = 21; + FF_IDCT_SIMPLENEON = 22; + FF_IDCT_SIMPLEALPHA = 23; + + FF_EC_GUESS_MVS = 1; + FF_EC_DEBLOCK = 2; + + FF_MM_FORCE = $80000000; (* force usage of selected flags (OR) *) + (* lower 16 bits - CPU features *) + FF_MM_MMX = $0001; ///< standard MMX + FF_MM_3DNOW = $0004; ///< AMD 3DNOW + FF_MM_MMXEXT = $0002; ///< SSE integer functions or AMD MMX ext + FF_MM_SSE = $0008; ///< SSE functions + FF_MM_SSE2 = $0010; ///< PIV SSE2 functions + FF_MM_3DNOWEXT = $0020; ///< AMD 3DNowExt + FF_MM_SSE3 = $0040; ///< Prescott SSE3 functions + FF_MM_SSSE3 = $0080; ///< Conroe SSSE3 functions + FF_MM_IWMMXT = $0100; ///< XScale IWMMXT + FF_MM_ALTIVEC = $0001; ///< standard AltiVec + + FF_PRED_LEFT = 0; + FF_PRED_PLANE = 1; + FF_PRED_MEDIAN = 2; + + FF_DEBUG_PICT_INFO = 1; + FF_DEBUG_RC = 2; + FF_DEBUG_BITSTREAM = 4; + FF_DEBUG_MB_TYPE = 8; + FF_DEBUG_QP = 16; + FF_DEBUG_MV = 32; + FF_DEBUG_DCT_COEFF = $00000040; + FF_DEBUG_SKIP = $00000080; + FF_DEBUG_STARTCODE = $00000100; + FF_DEBUG_PTS = $00000200; + FF_DEBUG_ER = $00000400; + FF_DEBUG_MMCO = $00000800; + FF_DEBUG_BUGS = $00001000; + FF_DEBUG_VIS_QP = $00002000; + FF_DEBUG_VIS_MB_TYPE = $00004000; + FF_DEBUG_BUFFERS = $00008000; + + FF_DEBUG_VIS_MV_P_FOR = $00000001; //visualize forward predicted MVs of P frames + FF_DEBUG_VIS_MV_B_FOR = $00000002; //visualize forward predicted MVs of B frames + FF_DEBUG_VIS_MV_B_BACK = $00000004; //visualize backward predicted MVs of B frames + + FF_CMP_SAD = 0; + FF_CMP_SSE = 1; + FF_CMP_SATD = 2; + FF_CMP_DCT = 3; + FF_CMP_PSNR = 4; + FF_CMP_BIT = 5; + FF_CMP_RD = 6; + FF_CMP_ZERO = 7; + FF_CMP_VSAD = 8; + FF_CMP_VSSE = 9; + FF_CMP_NSSE = 10; + FF_CMP_W53 = 11; + FF_CMP_W97 = 12; + FF_CMP_DCTMAX = 13; + FF_CMP_DCT264 = 14; + FF_CMP_CHROMA = 256; + + FF_DTG_AFD_SAME = 8; + FF_DTG_AFD_4_3 = 9; + FF_DTG_AFD_16_9 = 10; + FF_DTG_AFD_14_9 = 11; + FF_DTG_AFD_4_3_SP_14_9 = 13; + FF_DTG_AFD_16_9_SP_14_9 = 14; + FF_DTG_AFD_SP_4_3 = 15; + + FF_DEFAULT_QUANT_BIAS = 999999; + + FF_LAMBDA_SHIFT = 7; + FF_LAMBDA_SCALE = (1 shl FF_LAMBDA_SHIFT); + FF_QP2LAMBDA = 118; ///< factor to convert from H.263 QP to lambda + FF_LAMBDA_MAX = (256 * 128 - 1); + + FF_QUALITY_SCALE = FF_LAMBDA_SCALE; //FIXME maybe remove + + FF_CODER_TYPE_VLC = 0; + FF_CODER_TYPE_AC = 1; + FF_CODER_TYPE_RAW = 2; + FF_CODER_TYPE_RLE = 3; + FF_CODER_TYPE_DEFLATE = 4; + + SLICE_FLAG_CODED_ORDER = $0001; ///< draw_horiz_band() is called in coded order instead of display + SLICE_FLAG_ALLOW_FIELD = $0002; ///< allow draw_horiz_band() with field slices (MPEG2 field pics) + SLICE_FLAG_ALLOW_PLANE = $0004; ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + FF_MB_DECISION_SIMPLE = 0; ///< uses mb_cmp + FF_MB_DECISION_BITS = 1; ///< chooses the one which needs the fewest bits + FF_MB_DECISION_RD = 2; ///< rate distortion + + FF_AA_AUTO = 0; + FF_AA_FASTINT = 1; //not implemented yet + FF_AA_INT = 2; + FF_AA_FLOAT = 3; + + FF_PROFILE_UNKNOWN = -99; + FF_PROFILE_AAC_MAIN = 0; + FF_PROFILE_AAC_LOW = 1; + FF_PROFILE_AAC_SSR = 2; + FF_PROFILE_AAC_LTP = 3; + + FF_LEVEL_UNKNOWN = -99; + + X264_PART_I4X4 = $001; (* Analyse i4x4 *) + X264_PART_I8X8 = $002; (* Analyse i8x8 (requires 8x8 transform) *) + X264_PART_P8X8 = $010; (* Analyse p16x8, p8x16 and p8x8 *) + X264_PART_P4X4 = $020; (* Analyse p8x4, p4x8, p4x4 *) + X264_PART_B8X8 = $100; (* Analyse b16x8, b8x16 and b8x8 *) + + FF_COMPRESSION_DEFAULT = -1; + +const + AVPALETTE_SIZE = 1024; + AVPALETTE_COUNT = 256; + +type +(** + * AVPaletteControl + * This structure defines a method for communicating palette changes + * between and demuxer and a decoder. + * + * @deprecated Use AVPacket to send palette changes instead. + * This is totally broken. + *) + PAVPaletteControl = ^TAVPaletteControl; + TAVPaletteControl = record + (* demuxer sets this to 1 to indicate the palette has changed; + * decoder resets to 0 *) + palette_changed: cint; + + (* 4-byte ARGB palette entries, stored in native byte order; note that + * the individual palette components should be on a 8-bit scale; if + * the palette data comes from a IBM VGA native format, the component + * data is probably 6 bits in size and needs to be scaled *) + palette: array [0..AVPALETTE_COUNT - 1] of cuint; + end; {deprecated;} + +type + PAVClass = ^TAVClass; {const} + PAVCodecContext = ^TAVCodecContext; + + PAVCodec = ^TAVCodec; + + // int[4] + PQuadIntArray = ^TQuadIntArray; + TQuadIntArray = array[0..3] of cint; + // int (*func)(struct AVCodecContext *c2, void *arg) + TExecuteFunc = function(c2: PAVCodecContext; arg: Pointer): cint; cdecl; + + TAVClass = record + class_name: PAnsiChar; + (* actually passing a pointer to an AVCodecContext + or AVFormatContext, which begin with an AVClass. + Needed because av_log is in libavcodec and has no visibility + of AVIn/OutputFormat *) + item_name: function(): PAnsiChar; cdecl; + option: PAVOption; end; (** @@ -1536,13 +1273,6 @@ type * decoder to draw a horizontal band. It improves cache usage. Not * all codecs can do that. You must check the codec capabilities * beforehand. - * The function is also used by hardware acceleration APIs. - * It is called at least once during frame decoding to pass - * the data needed for hardware render. - * In that mode instead of pixel data, AVFrame points to - * a structure specific to the acceleration API. The application - * reads the structure and can change some fields to indicate progress - * or mark state. * - encoding: unused * - decoding: Set by user. * @param height the height of the slice @@ -1571,9 +1301,7 @@ type *) frame_size: cint; frame_number: cint; ///< audio or video frame number -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} real_pict_num: cint; ///< returns the real picture number of previous encoded frame -{$IFEND} (** * Number of frames the decoded output will be delayed relative to @@ -1762,9 +1490,6 @@ type * If pic.reference is set then the frame will be read later by libavcodec. * avcodec_align_dimensions() should be used to find the required width and * height, as they normally need to be rounded up to the next multiple of 16. - * if CODEC_CAP_DR1 is not set then get_buffer() must call - * avcodec_default_get_buffer() instead of providing buffers allocated by - * some other means. * - encoding: unused * - decoding: Set by libavcodec., user can override. *) @@ -1780,8 +1505,7 @@ type release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl; (** - * Size of the frame reordering buffer in the decoder. - * For MPEG-2 it is 1 IPB or 0 low delay IP. + * If 1 the stream has a 1 frame delay during decoding. * - encoding: Set by libavcodec. * - decoding: Set by libavcodec. *) @@ -2288,9 +2012,6 @@ type * libavcodec will pass previous buffer in pic, function should return * same buffer or new buffer with old frame "painted" into it. * If pic.data[0] == NULL must behave like get_buffer(). - * if CODEC_CAP_DR1 is not set then reget_buffer() must call - * avcodec_default_reget_buffer() instead of providing buffers allocated by - * some other means. * - encoding: unused * - decoding: Set by libavcodec., user can override *) @@ -2744,15 +2465,6 @@ type *) reordered_opaque: cint64; {$IFEND} - - {$IF LIBAVCODEC_VERSION >= 52028000} // 52.28.0 - (** - * This defines the location of chroma samples. - * - encoding: Set by user - * - decoding: Set by libavcodec - *) - chroma_sample_location: TAVChromaLocation; - {$IFEND} end; (** @@ -2767,11 +2479,7 @@ type encode: function (avctx: PAVCodecContext; buf: PByteArray; buf_size: cint; data: pointer): cint; cdecl; close: function (avctx: PAVCodecContext): cint; cdecl; decode: function (avctx: PAVCodecContext; outdata: pointer; var outdata_size: cint; - {$IF LIBAVCODEC_VERSION < 52025000} // 52.25.0 buf: {const} PByteArray; buf_size: cint): cint; cdecl; - {$ELSE} - avpkt: PAVPacket): cint; cdecl; - {$IFEND} (** * Codec capabilities. * see CODEC_CAP_* @@ -2787,8 +2495,8 @@ type pix_fmts: {const} PAVPixelFormat; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 {$IF LIBAVCODEC_VERSION >= 51055000} // 51.55.0 (** - * Descriptive name for the codec, meant to be more human readable than name. - * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + * Descriptive name for the codec, meant to be more human readable than \p name. + * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it. *) long_name: {const} PAnsiChar; {$IFEND} @@ -2803,105 +2511,6 @@ type {$IFEND} end; -{$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 -(** - * AVHWAccel. - *) - TAVHWAccel = record - (** - * Name of the hardware accelerated codec. - * The name is globally unique among encoders and among decoders (but an - * encoder and a decoder can share the same name). - *) - name: PAnsiChar; - - (** - * Type of codec implemented by the hardware accelerator. - * - * See CODEC_TYPE_xxx - *) - type_: TCodecType; - - (** - * Codec implemented by the hardware accelerator. - * - * See CODEC_ID_xxx - *) - id: TCodecID; - - (** - * Supported pixel format. - * - * Only hardware accelerated formats are supported here. - *) - pix_fmt: {const} PAVPixelFormat; - - (** - * Hardware accelerated codec capabilities. - * see FF_HWACCEL_CODEC_CAP_* - *) - capabilities: cint; - - next: PAVCodec; - - (** - * Called at the beginning of each frame or field picture. - * - * Meaningful frame information (codec specific) is guaranteed to - * be parsed at this point. This function is mandatory. - * - * Note that buf can be NULL along with buf_size set to 0. - * Otherwise, this means the whole frame is available at this point. - * - * @param avctx the codec context - * @param buf the frame data buffer base - * @param buf_size the size of the frame in bytes - * @return zero if successful, a negative value otherwise - *) - start_frame: function (avctx: PAVCodecContext; - buf: PByteArray; - buf_size: cint): cint; cdecl; - - (** - * Callback for each slice. - * - * Meaningful slice information (codec specific) is guaranteed to - * be parsed at this point. This function is mandatory. - * - * @param avctx the codec context - * @param buf the slice data buffer base - * @param buf_size the size of the slice in bytes - * @return zero if successful, a negative value otherwise - *) - decode_slice: function (avctx: PAVCodecContext; - buf: PByteArray; - buf_size: cint): cint; cdecl; - - (** - * Called at the end of each frame or field picture. - * - * The whole picture is parsed at this point and can now be sent - * to the hardware accelerator. This function is mandatory. - * - * @param avctx the codec context - * @return zero if successful, a negative value otherwise - *) - end_frame: function (avctx: PAVCodecContext): cint; cdecl; - -{$IF LIBAVCODEC_VERSION >= 52021000} // >= 52.21.0 - (** - * Size of HW accelerator private data. - * - * Private data is allocated with av_mallocz() before - * AVCodecContext.get_buffer() and deallocated after - * AVCodecContext.release_buffer(). - *) - priv_data_size: cint; -{$IFEND} - - end; -{$IFEND} - (** * four components are given, that's all. * the last component is alpha @@ -2985,69 +2594,9 @@ type {$IFEND} end; -{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 -{ packet functions } - -(** - * @deprecated use NULL instead - *) -procedure av_destruct_packet_nofree(pkt: PAVPacket); - cdecl; external av__codec; - -(* - * Default packet destructor. - *) -procedure av_destruct_packet(pkt: PAVPacket); - cdecl; external av__codec; - -(* - * Initialize optional fields of a packet with default values. - * - * @param pkt packet - *) -procedure av_init_packet(pkt: PAVPacket); - cdecl; external av__codec; - -(* - * Allocate the payload of a packet and initialize its fields with - * default values. - * - * @param pkt packet - * @param size wanted payload size - * @return 0 if OK, AVERROR_xxx otherwise - *) -function av_new_packet(pkt: PAVPacket; size: cint): cint; - cdecl; external av__codec; - -(* - * Reduce packet size, correctly zeroing padding - * - * @param pkt packet - * @param size new size - *) -procedure av_shrink_packet(pkt: PAVPacket; size: cint); - cdecl; external av__codec; - -(* - * @warning This is a hack - the packet memory allocation stuff is broken. The - * packet is allocated if it was not really allocated. - *) -function av_dup_packet(pkt: PAVPacket): cint; - cdecl; external av__codec; - -(* - * Free a packet. - * - * @param pkt packet to free - *) -procedure av_free_packet(pkt: PAVPacket); -{$IF LIBAVCODEC_VERSION >= 52028000} // 52.28.0 - cdecl; external av__codec; -{$IFEND} -{$IFEND} (* resample.c *) -type + PReSampleContext = pointer; PAVResampleContext = pointer; PImgReSampleContext = pointer; @@ -3062,44 +2611,15 @@ function audio_resample (s: PReSampleContext; output: PSmallint; input: PSmallin procedure audio_resample_close (s: PReSampleContext); cdecl; external av__codec; -(** - * Initializes an audio resampler. - * Note, if either rate is not an integer then simply scale both rates up so they are. - * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq - * @param log2_phase_count log2 of the number of entries in the polyphase filterbank - * @param linear If 1 then the used FIR filter will be linearly interpolated - between the 2 closest, if 0 the closest will be used - * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate - *) + function av_resample_init (out_rate: cint; in_rate: cint; filter_length: cint; log2_phase_count: cint; linear: cint; cutoff: cdouble): PAVResampleContext; cdecl; external av__codec; -(** - * resamples. - * @param src an array of unconsumed samples - * @param consumed the number of samples of src which have been consumed are returned here - * @param src_size the number of unconsumed samples available - * @param dst_size the amount of space in samples available in dst - * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. - * @return the number of samples written in dst or -1 if an error occurred - *) function av_resample (c: PAVResampleContext; dst: PSmallint; src: PSmallint; var consumed: cint; src_size: cint; dst_size: cint; update_ctx: cint): cint; cdecl; external av__codec; -(** - * Compensates samplerate/timestamp drift. The compensation is done by changing - * the resampler parameters, so no audible clicks or similar distortions occur - * @param compensation_distance distance in output samples over which the compensation should be performed - * @param sample_delta number of output samples which should be output less - * - * example: av_resample_compensate(c, 10, 500) - * here instead of 510 samples only 500 samples would be output - * - * note, due to rounding the actual compensation might be slightly different, - * especially if the compensation_distance is large and the in_rate used during init is small - *) procedure av_resample_compensate (c: PAVResampleContext; sample_delta: cint; compensation_distance: cint); cdecl; external av__codec; @@ -3107,6 +2627,7 @@ procedure av_resample_compensate (c: PAVResampleContext; sample_delta: cint; procedure av_resample_close (c: PAVResampleContext); cdecl; external av__codec; + {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 (* YUV420 format is assumed ! *) @@ -3139,6 +2660,7 @@ procedure img_resample (s: PImgReSampleContext; output: PAVPicture; input: {cons *) procedure img_resample_close (s: PImgReSampleContext); cdecl; external av__codec; deprecated; + {$IFEND} (** @@ -3170,7 +2692,6 @@ procedure avpicture_free (picture: PAVPicture); * If a planar format is specified, several pointers will be set pointing to * the different picture planes and the line sizes of the different planes * will be stored in the lines_sizes array. - * Call with ptr == NULL to get the required size for the ptr buffer. * * @param picture AVPicture whose fields are to be filled in * @param ptr Buffer which will contain or contains the actual image data @@ -3191,14 +2712,11 @@ function avpicture_layout (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; (** * Calculate the size in bytes that a picture of the given width and height * would occupy if stored in the given picture format. - * Note that this returns the size of a compact representation as generated - * by avpicture_layout, which can be smaller than the size required for e.g. - * avpicture_fill. * * @param pix_fmt the given picture format * @param width the width of the image * @param height the height of the image - * @return Image data size in bytes or -1 on error (e.g. too large dimensions). + * @return Image data size in bytes *) function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; @@ -3206,34 +2724,12 @@ function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint) procedure avcodec_get_chroma_sub_sample (pix_fmt: TAVPixelFormat; var h_shift: cint; var v_shift: cint); cdecl; external av__codec; -(** - * Returns the pixel format corresponding to the name \p name. - * - * If there is no pixel format with name \p name, then looks for a - * pixel format with the name corresponding to the native endian - * format of \p name. - * For example in a little-endian system, first looks for "gray16", - * then for "gray16le". - * - * Finally if no pixel format has been found, returns \c PIX_FMT_NONE. - *) function avcodec_get_pix_fmt_name(pix_fmt: TAVPixelFormat): PAnsiChar; cdecl; external av__codec; procedure avcodec_set_dimensions(s: PAVCodecContext; width: cint; height: cint); cdecl; external av__codec; -(** - * Returns the pixel format corresponding to the name name. - * - * If there is no pixel format with name name, then looks for a - * pixel format with the name corresponding to the native endian - * format of name. - * For example in a little-endian system, first looks for "gray16", - * then for "gray16le". - * - * Finally if no pixel format has been found, returns PIX_FMT_NONE. - *) function avcodec_get_pix_fmt(name: {const} PAnsiChar): TAVPixelFormat; cdecl; external av__codec; @@ -3277,7 +2773,7 @@ function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAV * some formats to other formats. avcodec_find_best_pix_fmt() searches which of * the given pixel formats should be used to suffer the least amount of loss. * The pixel formats from which it chooses one, are determined by the - * pix_fmt_mask parameter. + * \p pix_fmt_mask parameter. * * @code * src_pix_fmt = PIX_FMT_YUV420P; @@ -3295,13 +2791,9 @@ function avcodec_get_pix_fmt_loss (dst_pix_fmt: TAVPixelFormat; src_pix_fmt: TAV function avcodec_find_best_pix_fmt(pix_fmt_mask: cint64; src_pix_fmt: TAVPixelFormat; has_alpha: cint; loss_ptr: PCint): cint; cdecl; external av__codec; -{$ELSEIF LIBAVCODEC_VERSION < 52022001} -function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelFormat; - has_alpha: cint; loss_ptr: PCint): cint; - cdecl; external av__codec; {$ELSE} function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelFormat; - has_alpha: cint; loss_ptr: PCint): TAVPixelFormat; + has_alpha: cint; loss_ptr: PCint): cint; cdecl; external av__codec; {$IFEND} @@ -3316,13 +2808,8 @@ function avcodec_find_best_pix_fmt(pix_fmt_mask: cint; src_pix_fmt: TAVPixelForm * a negative value to print the corresponding header. * Meaningful values for obtaining a pixel format info vary from 0 to PIX_FMT_NB -1. *) -{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 procedure avcodec_pix_fmt_string (buf: PAnsiChar; buf_size: cint; pix_fmt: cint); cdecl; external av__codec; -{$ELSE} -procedure avcodec_pix_fmt_string (buf: PAnsiChar; buf_size: cint; pix_fmt: TAVPixelFormat); - cdecl; external av__codec; -{$IFEND} {$IFEND} const @@ -3335,8 +2822,7 @@ const *) function img_get_alpha_info (src: {const} PAVPicture; pix_fmt: TAVPixelFormat; - width: cint; - height: cint): cint; + width: cint; height: cint): cint; cdecl; external av__codec; {$IF LIBAVCODEC_VERSION < 52000000} // 52.0.0 @@ -3352,11 +2838,8 @@ function img_convert (dst: PAVPicture; dst_pix_fmt: TAVPixelFormat; (* deinterlace a picture *) (* deinterlace - if not supported return -1 *) -function avpicture_deinterlace (dst: PAVPicture; - src: {const} PAVPicture; - pix_fmt: TAVPixelFormat; - width: cint; - height: cint): cint; +function avpicture_deinterlace (dst: PAVPicture; src: {const} PAVPicture; + pix_fmt: TAVPixelFormat; width: cint; height: cint): cint; cdecl; external av__codec; {* external high level API *} @@ -3369,11 +2852,6 @@ var {$IFEND} {$IF LIBAVCODEC_VERSION >= 51049000} // 51.49.0 -(** - * If c is NULL, returns the first registered codec, - * if c is non-NULL, returns the next registered codec after c, - * or NULL if c is the last one. - *) function av_codec_next(c: PAVCodec): PAVCodec; cdecl; external av__codec; {$IFEND} @@ -3393,27 +2871,20 @@ function avcodec_build(): cuint; (** * Initializes libavcodec. * - * @warning This function must be called before any other libavcodec + * @warning This function \e must be called before any other libavcodec * function. *) procedure avcodec_init(); cdecl; external av__codec; (** - * Register the codec codec and initialize libavcodec. + * Register the codec \p codec and initialize libavcodec. * * @see avcodec_init() *) -{$IF LIBAVCODEC_VERSION >= 52014000} // 52.14.0 -procedure avcodec_register(codec: PAVCodec); - cdecl; external av__codec; -// Deprecated in favor of avcodec_register. -procedure register_avcodec(codec: PAVCodec); - cdecl; external av__codec; deprecated; -{$ELSEIF LIBAVCODEC_VERSION_MAJOR < 53} procedure register_avcodec(codec: PAVCodec); cdecl; external av__codec; -{$IFEND} + (** * Finds a registered encoder with a matching codec ID. * @@ -3579,189 +3050,125 @@ function avcodec_open(avctx: PAVCodecContext; codec: PAVCodec): cint; {$IF LIBAVCODEC_VERSION < 52000000} // < 52.0.0 (** - * @deprecated Use avcodec_decode_audio2 instead. + * @deprecated Use avcodec_decode_audio2() instead. *) function avcodec_decode_audio(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; buf: {const} PByteArray; buf_size: cint): cint; - cdecl; external av__codec; {deprecated;} + cdecl; external av__codec; {$IFEND} -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} {$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0 (** - * Decodes an audio frame from buf into samples. - * Wrapper function which calls avcodec_decode_audio3. - * - * @deprecated Use avcodec_decode_audio3 instead. - * @param avctx the codec context - * @param[out] samples the output buffer - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] buf the input buffer - * @param[in] buf_size the input buffer size in bytes - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - *) -function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; - var frame_size_ptr: cint; - buf: {const} PByteArray; buf_size: cint): cint; - cdecl; external av__codec; {deprecated;} -{$IFEND} -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 -(** - * Decodes the audio frame of size avpkt->size from avpkt->data into samples. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * If no frame - * could be decompressed, frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in bytes. + * Decodes an audio frame from \p buf into \p samples. + * The avcodec_decode_audio2() function decodes an audio frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * audio codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in output buffer \p samples. If no frame + * could be decompressed, \p frame_size_ptr is zero. Otherwise, it is the + * decompressed frame size in \e bytes. * - * @warning You must set frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio3(). + * @warning You \e must set \p frame_size_ptr to the allocated size of the + * output buffer before calling avcodec_decode_audio2(). * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * - * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that + * @warning The end of the input buffer \p buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note You might have to align the input buffer avpkt->data and output buffer + * @note You might have to align the input buffer \p buf and output buffer \p * samples. The alignment requirements depend on the CPU: On some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others - * * it will work but it will have an impact on performance. - * - * In practice, avpkt->data should have 4 byte alignment at minimum and - * samples should be 16 byte aligned unless the CPU doesn't need it - * (AltiVec and SSE do). + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. * * @note Some codecs have a delay between input and output, these need to be - * feeded with avpkt->data=NULL, avpkt->size=0 at the end to return the remaining frames. + * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames. * * @param avctx the codec context * @param[out] samples the output buffer * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields. - * All decoders are designed to use the least fields possible though. + * @param[in] buf the input buffer + * @param[in] buf_size the input buffer size in bytes * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame could be decompressed. *) -function avcodec_decode_audio3(avctx: PAVCodecContext; samples: PSmallint; +function avcodec_decode_audio2(avctx: PAVCodecContext; samples: PSmallint; var frame_size_ptr: cint; - avpkt: PAVPacket): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; {$IFEND} -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} (** - * Decodes a video frame from buf into picture. - * Wrapper function which calls avcodec_decode_video2. + * Decodes a video frame from \p buf into \p picture. + * The avcodec_decode_video() function decodes a video frame from the input + * buffer \p buf of size \p buf_size. To decode it, it makes use of the + * video codec which was coupled with \p avctx using avcodec_open(). The + * resulting decoded frame is stored in \p picture. * - * @deprecated Use avcodec_decode_video2 instead. - * @param avctx the codec context - * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] buf the input buffer - * @param[in] buf_size the size of the input buffer in bytes - * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame could be decompressed. - *) -function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; - var got_picture_ptr: cint; - buf: {const} PByteArray; buf_size: cint): cint; - cdecl; external av__codec; {deprecated;} -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 -(** - * Decodes the video frame of size avpkt->size from avpkt->data into picture. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. - * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * - * @warning The end of the input buffer buf should be set to 0 to ensure that + * @warning The end of the input buffer \p buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note You might have to align the input buffer avpkt->data. - * The alignment requirements depend on the CPU: on some CPUs it isn't + * @note You might have to align the input buffer \p buf and output buffer \p + * samples. The alignment requirements depend on the CPU: on some CPUs it isn't * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. - * - * In practice, avpkt->data should have 4 byte alignment at minimum. + * it will work but it will have an impact on performance. In practice, the + * bitstream should have 4 byte alignment at minimum and all sample data should + * be 16 byte aligned unless the CPU doesn't need it (AltiVec and SSE do). If + * the linesize is not a multiple of 16 then there's no sense in aligning the + * start of the buffer to 16. * * @param avctx the codec context * @param[out] picture The AVFrame in which the decoded video frame will be stored. - * @param[in] avpkt The input AVpacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields like - * flags&PKT_FLAG_KEY. All decoders are designed to use the least - * fields possible. + * @param[in] buf the input buffer + * @param[in] buf_size the size of the input buffer in bytes * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. * @return On error a negative value is returned, otherwise the number of bytes * used or zero if no frame could be decompressed. *) -function avcodec_decode_video2(avctx: PAVCodecContext; picture: PAVFrame; +function avcodec_decode_video(avctx: PAVCodecContext; picture: PAVFrame; var got_picture_ptr: cint; - avpkt: PAVPacket): cint; + buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; -{$IFEND} -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} (* Decode a subtitle message. Return -1 if error, otherwise return the * number of bytes used. If no subtitle could be decompressed, - * got_sub_ptr is zero. Otherwise, the subtitle is stored in*sub. - *) + * got_sub_ptr is zero. Otherwise, the subtitle is stored in *sub. *) function avcodec_decode_subtitle(avctx: PAVCodecContext; sub: PAVSubtitle; var got_sub_ptr: cint; buf: {const} PByteArray; buf_size: cint): cint; cdecl; external av__codec; -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0 -(* Decodes a subtitle message. - * Returns a negative value on error, otherwise returns the number of bytes used. - * If no subtitle could be decompressed, got_sub_ptr is zero. - * Otherwise, the subtitle is stored in sub. - * - * @param avctx the codec context - * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored. - * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. - * @param[in] avpkt The input AVPacket containing the input buffer. - *) -function avcodec_decode_subtitle2(avctx: PAVCodecContext; sub: PAVSubtitle; - var got_sub_ptr: cint; - avpkt: PAVPacket): cint; - cdecl; external av__codec; -{$IFEND} - function avcodec_parse_frame(avctx: PAVCodecContext; pdata: PPointer; data_size_ptr: PCint; buf: PByteArray; buf_size: cint): cint; cdecl; external av__codec; (** - * Encodes an audio frame from samples into buf. + * Encodes an audio frame from \p samples into \p buf. + * The avcodec_encode_audio() function encodes an audio frame from the input + * buffer \p samples. To encode it, it makes use of the audio codec which was + * coupled with \p avctx using avcodec_open(). The resulting encoded frame is + * stored in output buffer \p buf. * - * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. - * However, for PCM audio the user will know how much space is needed - * because it depends on the value passed in buf_size as described - * below. In that case a lower value can be used. + * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large. * * @param avctx the codec context * @param[out] buf the output buffer * @param[in] buf_size the output buffer size * @param[in] samples the input buffer containing the samples * The number of samples read from this buffer is frame_size*channels, - * both of which are defined in avctx. - * For PCM audio the number of samples read from samples is equal to - * buf_size * input_sample_size / output_sample_size. + * both of which are defined in \p avctx. + * For PCM audio the number of samples read from \p samples is equal to + * \p buf_size * input_sample_size / output_sample_size. * @return On error a negative value is returned, on success zero or the number * of bytes used to encode the data read from the input buffer. *) @@ -3770,9 +3177,12 @@ function avcodec_encode_audio(avctx: PAVCodecContext; buf: PByte; cdecl; external av__codec; (** - * Encodes a video frame from pict into buf. - * The input picture should be - * stored using a specific format, namely avctx.pix_fmt. + * Encodes a video frame from \p pict into \p buf. + * The avcodec_encode_video() function encodes a video frame from the input + * \p pict. To encode it, it makes use of the video codec which was coupled with + * \p avctx using avcodec_open(). The resulting encoded bytes representing the + * frame are stored in the output buffer \p buf. The input picture should be + * stored using a specific format, namely \c avctx.pix_fmt. * * @param avctx the codec context * @param[out] buf the output buffer for the bitstream of encoded frame @@ -3798,7 +3208,6 @@ function avcodec_close(avctx: PAVCodecContext): cint; * functions. * * @see register_avcodec - * @see avcodec_register * @see av_register_codec_parser * @see av_register_bitstream_filter *) @@ -3817,7 +3226,7 @@ procedure avcodec_default_free_buffers(s: PAVCodecContext); (* misc useful functions *) (** - * Returns a single letter to describe the given picture type pict_type. + * Returns a single letter to describe the given picture type \p pict_type. * * @param[in] pict_type the picture type * @return A single character representing the picture type. @@ -3862,15 +3271,6 @@ type next_frame_offset: cint64; (* offset of the next frame *) (* video info *) pict_type: cint; (* XXX: put it back in AVCodecContext *) - (** - * This field is used for proper frame duration computation in lavf. - * It signals, how much longer the frame duration of the current frame - * is compared to normal frame duration. - * - * frame_duration = (1 + repeat_pict) * time_base - * - * It is used by codecs like H.264 to display telecined material. - *) repeat_pict: cint; (* XXX: put it back in AVCodecContext *) pts: cint64; (* pts of the current frame *) dts: cint64; (* dts of the current frame *) @@ -3893,94 +3293,6 @@ type {$IF LIBAVCODEC_VERSION >= 51057001} // 51.57.1 cur_frame_end: array [0..AV_PARSER_PTS_NB - 1] of cint64; {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52016000} // 52.16.0 - (*! - * Set by parser to 1 for key frames and 0 for non-key frames. - * It is initialized to -1, so if the parser doesn't set this flag, - * old-style fallback using FF_I_TYPE picture type as key frames - * will be used. - *) - key_frame: cint; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 - (** - * Time difference in stream time base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current frame. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. - *) - convergence_duration: cint64; - {$IFEND} - {$IF LIBAVCODEC_VERSION >= 52019000} // 52.19.0 - // Timestamp generation support: - (** - * Synchronization point for start of timestamp generation. - * - * Set to >0 for sync point, 0 for no sync point and <0 for undefined - * (default). - * - * For example, this corresponds to presence of H.264 buffering period - * SEI message. - *) - dts_sync_point: cint; - - (** - * Offset of the current timestamp against last timestamp sync point in - * units of AVCodecContext.time_base. - * - * Set to INT_MIN when dts_sync_point unused. Otherwise, it must - * contain a valid timestamp offset. - * - * Note that the timestamp of sync point has usually a nonzero - * dts_ref_dts_delta, which refers to the previous sync point. Offset of - * the next frame after timestamp sync point will be usually 1. - * - * For example, this corresponds to H.264 cpb_removal_delay. - *) - dts_ref_dts_delta: cint; - - (** - * Presentation delay of current frame in units of AVCodecContext.time_base. - * - * Set to INT_MIN when dts_sync_point unused. Otherwise, it must - * contain valid non-negative timestamp delta (presentation time of a frame - * must not lie in the past). - * - * This delay represents the difference between decoding and presentation - * time of the frame. - * - * For example, this corresponds to H.264 dpb_output_delay. - *) - pts_dts_delta: cint; - {$IFEND} - - {$IF LIBAVCODEC_VERSION >= 52021000} // 52.21.0 - (** - * Position of the packet in file. - * - * Analogous to cur_frame_pts/dts - *) - cur_frame_pos: array [0..AV_PARSER_PTS_NB - 1] of cint64; - - (** - * Byte position of currently parsed frame in stream. - *) - pos: cint64; - - (** - * Previous frame byte position. - *) - last_pos: cint64; - {$IFEND} end; TAVCodecParser = record @@ -4015,60 +3327,12 @@ procedure av_register_codec_parser(parser: PAVCodecParser); function av_parser_init(codec_id: cint): PAVCodecParserContext; cdecl; external av__codec; -{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53} function av_parser_parse(s: PAVCodecParserContext; avctx: PAVCodecContext; - poutbuf: PPointer; - poutbuf_size: PCint; - buf: {const} PByteArray; - buf_size: cint; - pts: cint64; - dts: cint64): cint; - cdecl; external av__codec; deprecated; -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52021000} // 52.21.0 -(** - * Parse a packet. - * - * @param s parser context. - * @param avctx codec context. - * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. - * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. - * @param buf input buffer. - * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). - * @param pts input presentation timestamp. - * @param dts input decoding timestamp. - * @param pos input byte position in stream. - * @return the number of bytes of the input bitstream used. - * - * Example: - * @code - * while (in_len) do - * begin - * len := av_parser_parse2(myparser, AVCodecContext, data, size, - * in_data, in_len, - * pts, dts, pos); - * in_data := in_data + len; - * in_len := in_len - len; - * - * if (size) then - * decode_frame(data, size); - * end; - * @endcode - *) -function av_parser_parse2(s: PAVCodecParserContext; - avctx: PAVCodecContext; - poutbuf: PPointer; - poutbuf_size: PCint; - buf: {const} PByteArray; - buf_size: cint; - pts: cint64; - dts: cint64; - pos: cint64): cint; - cdecl; external av__codec; -{$IFEND} - + poutbuf: PPointer; poutbuf_size: PCint; + buf: {const} PByteArray; buf_size: cint; + pts: cint64; dts: cint64): cint; + cdecl; external av__codec; function av_parser_change(s: PAVCodecParserContext; avctx: PAVCodecContext; poutbuf: PPointer; poutbuf_size: PCint; @@ -4131,22 +3395,6 @@ function av_bitstream_filter_next(f: PAVBitStreamFilter): PAVBitStreamFilter; procedure av_fast_realloc(ptr: pointer; size: PCuint; min_size: cuint); cdecl; external av__codec; -{$IF LIBAVCODEC_VERSION >= 52025000} // >= 52.25.0 -(** - * Allocates a buffer, reusing the given one if large enough. - * - * Contrary to av_fast_realloc the current buffer contents might not be - * preserved and on error the old buffer is freed, thus no special - * handling to avoid memleaks is necessary. - * - * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer - * @param size size of the buffer *ptr points to - * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and - * *size 0 if an error occurred. - *) -procedure av_fast_malloc(ptr: pointer; size: PCuint; min_size: cuint); - cdecl; external av__codec; -{$IFEND} {$IF LIBAVCODEC_VERSION < 51057000} // 51.57.0 (* for static data only *) @@ -4159,7 +3407,7 @@ procedure av_fast_malloc(ptr: pointer; size: PCuint; min_size: cuint); * and should correctly use static arrays * *) -procedure av_free_static(); +procedure av_free_static(); cdecl; external av__codec; deprecated; (** @@ -4185,49 +3433,22 @@ procedure av_realloc_static(ptr: pointer; size: cuint); (** * Copy image 'src' to 'dst'. *) -procedure av_picture_copy(dst: PAVPicture; - src: {const} PAVPicture; -{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 - pix_fmt: cint; -{$ELSE} - pix_fmt: TAVPixelFormat; -{$IFEND} - width: cint; - height: cint); +procedure av_picture_copy(dst: PAVPicture; src: {const} PAVPicture; + pix_fmt: cint; width: cint; height: cint); cdecl; external av__codec; (** * Crop image top and left side. *) -function av_picture_crop(dst: PAVPicture; - src: {const} PAVPicture; -{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 - pix_fmt: cint; -{$ELSE} - pix_fmt: TAVPixelFormat; -{$IFEND} - top_band: cint; - left_band: cint): cint; +function av_picture_crop(dst: PAVPicture; src: {const} PAVPicture; + pix_fmt: cint; top_band: cint; left_band: cint): cint; cdecl; external av__codec; (** * Pad image. *) -function av_picture_pad(dst: PAVPicture; - src: {const} PAVPicture; - height: cint; - width: cint; -{$IF LIBAVCODEC_VERSION < 52022001} // 52.22.1 - pix_fmt: cint; -{$ELSE} - pix_fmt: TAVPixelFormat; -{$IFEND} - padtop: cint; - padbottom: cint; - padleft: cint; - padright: - cint; - color: PCint): cint; +function av_picture_pad(dst: PAVPicture; src: {const} PAVPicture; height: cint; width: cint; pix_fmt: cint; + padtop: cint; padbottom: cint; padleft: cint; padright: cint; color: PCint): cint; cdecl; external av__codec; {$IFEND} @@ -4260,7 +3481,7 @@ function av_xiphlacing(s: PByte; v: cuint): cuint; {$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0 (** - * Parses str and put in width_ptr and height_ptr the detected values. + * Parses \p str and put in \p width_ptr and \p height_ptr the detected values. * * @return 0 in case of a successful parsing, a negative value otherwise * @param[in] str the string to parse: it has to be a string in the format @@ -4274,11 +3495,11 @@ function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {co cdecl; external av__codec; (** - * Parses str and put in frame_rate the detected values. + * Parses \p str and put in \p frame_rate the detected values. * * @return 0 in case of a successful parsing, a negative value otherwise * @param[in] str the string to parse: it has to be a string in the format - * <frame_rate_num>/<frame_rate_den>, a float number or a valid video rate abbreviation + * <frame_rate_nom>/<frame_rate_den>, a float number or a valid video rate abbreviation * @param[in,out] frame_rate pointer to the AVRational which will contain the detected * frame rate *) @@ -4297,13 +3518,11 @@ const EDOM = ESysEDOM; ENOSYS = ESysENOSYS; EILSEQ = ESysEILSEQ; - EPIPE = ESysEPIPE; {$ELSE} ENOENT = 2; EIO = 5; ENOMEM = 12; EINVAL = 22; - EPIPE = 32; // just an assumption. needs to be checked. EDOM = 33; {$IFDEF MSWINDOWS} // Note: we assume that ffmpeg was compiled with MinGW. @@ -4340,76 +3559,11 @@ const AVERROR_NOMEM = AVERROR_SIGN * ENOMEM; (**< not enough memory *) AVERROR_NOFMT = AVERROR_SIGN * EILSEQ; (**< unknown format *) AVERROR_NOTSUPP = AVERROR_SIGN * ENOSYS; (**< Operation not supported. *) - AVERROR_NOENT = AVERROR_SIGN * ENOENT; (**< No such file or directory. *) -{$IF LIBAVCODEC_VERSION >= 52017000} // 52.17.0 - AVERROR_EOF = AVERROR_SIGN * EPIPE; (**< End of file. *) -{$IFEND} + AVERROR_NOENT = AVERROR_SIGN * ENOENT; {**< No such file or directory. *} // Note: function calls as constant-initializers are invalid //AVERROR_PATCHWELCOME = -MKTAG('P','A','W','E'); {**< Not yet implemented in FFmpeg. Patches welcome. *} AVERROR_PATCHWELCOME = -(ord('P') or (ord('A') shl 8) or (ord('W') shl 16) or (ord('E') shl 24)); -{$IF LIBAVCODEC_VERSION >= 52018000} // 52.18.0 -(** - * Registers the hardware accelerator hwaccel. - *) -procedure av_register_hwaccel (hwaccel: PAVHWAccel) - cdecl; external av__codec; - -(** - * If hwaccel is NULL, returns the first registered hardware accelerator, - * if hwaccel is non-NULL, returns the next registered hardware accelerator - * after hwaccel, or NULL if hwaccel is the last one. - *) -function av_hwaccel_next (hwaccel: PAVHWAccel): PAVHWAccel; - cdecl; external av__codec; -{$IFEND} - -{$IF LIBAVCODEC_VERSION >= 52030000} // 52.30.0 -(** - * Lock operation used by lockmgr - *) -type - TAVLockOp = ( - AV_LOCK_CREATE, ///< Create a mutex - AV_LOCK_OBTAIN, ///< Lock the mutex - AV_LOCK_RELEASE, ///< Unlock the mutex - AV_LOCK_DESTROY ///< Free mutex resources - ); - -(** - * Register a user provided lock manager supporting the operations - * specified by AVLockOp. mutex points to a (void) where the - * lockmgr should store/get a pointer to a user allocated mutex. It's - * NULL upon AV_LOCK_CREATE and != NULL for all other ops. - * - * @param cb User defined callback. Note: FFmpeg may invoke calls to this - * callback during the call to av_lockmgr_register(). - * Thus, the application must be prepared to handle that. - * If cb is set to NULL the lockmgr will be unregistered. - * Also note that during unregistration the previously registered - * lockmgr callback may also be invoked. - *) -// ToDo: Implement and test this -//function av_lockmgr_register(cb: function (mutex: pointer; op: TAVLockOp)): cint; -// cdecl; external av__codec; -{$IFEND} - implementation -{$IF (LIBAVCODEC_VERSION >= 52025000) and (LIBAVCODEC_VERSION <= 5202700)} // 52.25.0 -procedure av_free_packet(pkt: PAVPacket);{$IFDEF HASINLINE} inline; {$ENDIF} -begin - if (pkt <> nil) then - begin - if (pkt.destruct <> nil) then - pkt.destruct(pkt) - else - begin - pkt.data = NULL; - pkt.size = 0; - end; - end; -end; -{$IFEND} - end. diff --git a/unicode/src/lib/ffmpeg/avformat.pas b/unicode/src/lib/ffmpeg/avformat.pas index 0ec2c118..62df8a83 100644 --- a/unicode/src/lib/ffmpeg/avformat.pas +++ b/unicode/src/lib/ffmpeg/avformat.pas @@ -29,11 +29,6 @@ * Min. version: 50.5.0 , revision 6577, Sat Oct 7 15:30:46 2006 UTC * Max. version: 52.25.0, revision 16986, Wed Feb 4 05:56:39 2009 UTC *) -{ - * update to - * Max. version: 52.34.0, Sat Jun 13 00:37:00 2009 UTC - * MiSchi -} unit avformat; @@ -65,7 +60,7 @@ uses const (* Max. supported version by this header *) LIBAVFORMAT_MAX_VERSION_MAJOR = 52; - LIBAVFORMAT_MAX_VERSION_MINOR = 34; + LIBAVFORMAT_MAX_VERSION_MINOR = 25; LIBAVFORMAT_MAX_VERSION_RELEASE = 0; LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -97,11 +92,13 @@ function avformat_version(): cuint; cdecl; external av__format; {$IFEND} + type PAVFile = Pointer; (* * Public Metadata API. + * !!WARNING!! This is a work in progress. Don't use outside FFmpeg for now. * The metadata API allows libavformat to export metadata tags to a client * application using a sequence of key/value pairs. * Important concepts to keep in mind: @@ -114,7 +111,7 @@ type * want to store, e.g., the email address of the child of producer Alice * and actor Bob, that could have key=alice_and_bobs_childs_email_address. * 3. A tag whose value is localized for a particular language is appended - * with a dash character ('-') and the ISO 639-2/B 3-letter language code. + * with a dash character ('-') and the ISO 639 3-letter language code. * For example: Author-ger=Michael, Author-eng=Mike * The original/default language is in the unqualified "Author" tag. * A demuxer should set a default if it sets any translated tag. @@ -133,51 +130,53 @@ type PAVMetadata = Pointer; {$IF LIBAVFORMAT_VERSION > 52024001} // > 52.24.1 + (** - * Gets a metadata element with matching key. - * @param prev Set to the previous matching element to find the next. - * @param flags Allows case as well as suffix-insensitive comparisons. - * @return Found tag or NULL, changing key or value leads to undefined behavior. + * gets a metadata element with matching key. + * @param prev set to the previous matching element to find the next. + * @param flags allows case as well as suffix insensitive comparisons. + * @return found tag or NULL, changing key or value leads to undefined behavior. *) function av_metadata_get(m: PAVMetadata; key: {const} PAnsiChar; prev: {const} PAVMetadataTag ; flags: cint): PAVMetadataTag; cdecl; external av__format; (** - * Sets the given tag in m, overwriting an existing tag. - * @param key tag key to add to m (will be av_strduped) - * @param value tag value to add to m (will be av_strduped) - * @return >= 0 on success otherwise an error code <0 + * sets the given tag in m, overwriting an existing tag. + * @param key tag key to add to m (will be av_strduped). + * @param value tag value to add to m (will be av_strduped). + * @return >= 0 if success otherwise error code that is <0. *) function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint; cdecl; external av__format; (** - * Frees all the memory allocated for an AVMetadata struct. + * Free all the memory allocated for an AVMetadata struct. *) procedure av_metadata_free(var m: PAVMetadata); cdecl; external av__format; + {$IFEND} (* packet functions *) -{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 type PAVPacket = ^TAVPacket; TAVPacket = record (** - * Presentation timestamp in time_base units; the time at which the - * decompressed packet will be presented to the user. + * Presentation time stamp in time_base units. + * This is the time at which the decompressed packet will be presented + * to the user. * Can be AV_NOPTS_VALUE if it is not stored in the file. * pts MUST be larger or equal to dts as presentation can not happen before * decompression, unless one wants to view hex dumps. Some formats misuse - * the terms dts and pts/cts to mean something different. Such timestamps + * the terms dts and pts/cts to mean something different, these timestamps * must be converted to true pts/dts before they are stored in AVPacket. *) pts: cint64; (** - * Decompression timestamp in time_base units; the time at which the - * packet is decompressed. + * Decompression time stamp in time_base units. + * This is the time at which the packet is decompressed. * Can be AV_NOPTS_VALUE if it is not stored in the file. *) dts: cint64; @@ -246,7 +245,6 @@ procedure av_init_packet(var pkt: TAVPacket); *) function av_new_packet(var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; -{$IFEND} (** * Allocate and read the payload of a packet and initialize its fields with @@ -259,7 +257,6 @@ function av_new_packet(var pkt: TAVPacket; size: cint): cint; function av_get_packet(s: PByteIOContext; var pkt: TAVPacket; size: cint): cint; cdecl; external av__format; -{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 (** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. @@ -273,7 +270,6 @@ function av_dup_packet(pkt: PAVPacket): cint; * @param pkt packet to free *) procedure av_free_packet(pkt: PAVPacket); {$IFDEF HasInline}inline;{$ENDIF} -{$IFEND} (*************************************************) (* fractional numbers for exact pts handling *) @@ -282,6 +278,7 @@ type (** * The exact value of the fractional number is: 'val + num / den'. * num is assumed to be 0 <= num < den. + * @deprecated Use AVRational instead. *) PAVFrac = ^TAVFrac; TAVFrac = record @@ -300,7 +297,7 @@ type end; const - AVPROBE_SCORE_MAX = 100; ///< Maximum score, half of that is used for file-extension-based detection + AVPROBE_SCORE_MAX = 100; ///< Maximum score, half of that is used for file-extension-based detection. AVPROBE_PADDING_SIZE = 32; ///< extra allocated bytes at the end of the probe buffer //! Demuxer will use url_fopen, no opened file should be provided by the caller. @@ -313,9 +310,6 @@ const AVFMT_NOTIMESTAMPS = $0080; (**< Format does not need / have any timestamps. *) AVFMT_GENERIC_INDEX = $0100; (**< Use generic index building code. *) AVFMT_TS_DISCONT = $0200; (**< Format allows timestamp discontinuities. *) - {$IF LIBAVFORMAT_VERSION >= 52029002} // 52.29.2 - AVFMT_VARIABLE_FPS = $0400; (**< Format allows variable fps. *) - {$IFEND} // used by AVIndexEntry AVINDEX_KEYFRAME = $0001; @@ -326,7 +320,7 @@ const AVFMT_NOOUTPUTLOOP = -1; AVFMT_INFINITEOUTPUTLOOP = 0; - AVFMT_FLAG_GENPTS = $0001; ///< Generate missing pts even if it requires parsing future frames. + AVFMT_FLAG_GENPTS = $0001; ///< Generate pts if missing even if it requires parsing future frames. AVFMT_FLAG_IGNIDX = $0002; ///< Ignore index. AVFMT_FLAG_NONBLOCK = $0004; ///< Do not block when reading packets from input. @@ -345,11 +339,7 @@ const AV_DISPOSITION_KARAOKE = $0020; // used by TAVFormatContext.debug - FF_FDEBUG_TS = 0001; - - {$IF LIBAVFORMAT_VERSION >= 52034000} // > 52.34.0 - MAX_PROBE_PACKETS = 100; - {$IFEND} + FF_FDEBUG_TS = 0001; type PPAVCodecTag = ^PAVCodecTag; @@ -377,29 +367,12 @@ type PAVImageInfo = ^TAVImageInfo; {$IFEND} -{$IF LIBAVFORMAT_VERSION >= 52030001} // >= 52.30.1 -(** - * Convert all the metadata sets from ctx according to the source and - * destination conversion tables. - * @param d_conv destination tags format conversion table - * @param s_conv source tags format conversion table - *) - PAVMetadataConv = ^TAVMetadataConv; - TAVMetadataConv = record - ctx: PAVFormatContext; - d_conv: {const} PAVMetadataConv; - s_conv: {const} PAVMetadataConv; - end; -{$IFEND} - PAVChapter = ^TAVChapter; TAVChapter = record id: cint; ///< unique ID to identify the chapter time_base: TAVRational; ///< time base in which the start/end timestamps are specified start, end_: cint64; ///< chapter start/end time in time_base units - {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 title: PAnsiChar; ///< chapter title - {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52024001} // 52.24.1 metadata: PAVMetadata; {$IFEND} @@ -442,13 +415,13 @@ type name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) long_name: PAnsiChar; mime_type: PAnsiChar; extensions: PAnsiChar; (**< comma-separated filename extensions *) - (** size of private data so that it can be allocated in the wrapper *) + (** Size of private data so that it can be allocated in the wrapper. *) priv_data_size: cint; (* output support *) audio_codec: TCodecID; (**< default audio codec *) @@ -466,7 +439,7 @@ type {$IF LIBAVFORMAT_VERSION >= 51008000} // 51.8.0 (** * List of supported codec_id-codec_tag pairs, ordered by "better - * choice first". The arrays are all terminated by CODEC_ID_NONE. + * choice first". The arrays are all CODEC_ID_NONE terminated. *) codec_tag: {const} PPAVCodecTag; {$IFEND} @@ -475,10 +448,6 @@ type subtitle_codec: TCodecID; (**< default subtitle codec *) {$IFEND} - {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1 - {const} metadata_conv: PAVMetadataConv; - {$IFEND} - (* private fields *) next: PAVOutputFormat; end; @@ -487,14 +456,14 @@ type name: PAnsiChar; (** * Descriptive name for the format, meant to be more human-readable - * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro * to define it. *) long_name: PAnsiChar; (** Size of private data so that it can be allocated in the wrapper. *) priv_data_size: cint; (** - * Tell if a given file has a chance of being parsed as this format. + * Tell if a given file has a chance of being parsed by this format. * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes * big so you do not have to check for that unless you need more. *) @@ -506,28 +475,21 @@ type read_header: function (c: PAVFormatContext; ap: PAVFormatParameters): cint; cdecl; (** Read one packet and put it in 'pkt'. pts and flags are also set. 'av_new_stream' can be called only if the flag - AVFMTCTX_NOHEADER is used. - @return 0 on success, < 0 on error. - When returning an error, pkt must not have been allocated - or must be freed before returning *) + AVFMTCTX_NOHEADER is used. *) read_packet: function (c: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; (** Close the stream. The AVFormatContext and AVStreams are not freed by this function *) read_close: function (c: PAVFormatContext): cint; cdecl; - -{$IF LIBAVFORMAT_VERSION_MAJOR < 53} (** * Seek to a given timestamp relative to the frames in * stream component stream_index. - * @param stream_index Must not be -1. - * @param flags Selects which direction should be preferred if no exact - * match is available. + * @param stream_index must not be -1 + * @param flags selects which direction should be preferred if no exact + * match is available * @return >= 0 on success (but not necessarily the new offset) *) read_seek: function (c: PAVFormatContext; stream_index: cint; timestamp: cint64; flags: cint): cint; cdecl; -{$IFEND} - (** * Gets the next timestamp in stream[stream_index].time_base units. * @return the timestamp or AV_NOPTS_VALUE if an error occurred @@ -555,25 +517,6 @@ type codec_tag: {const} PPAVCodecTag; {$IFEND} - {$IF LIBAVFORMAT_VERSION >= 52030000} // 52.30.0 - (** - * Seek to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - *) - read_seek2: function (s: PAVFormatContext; - stream_index: cint; - min_ts: cint64; - ts: cint64; - max_ts: cint64; - flags: cint): cint; cdecl; - {$IFEND} - - {$IF LIBAVFORMAT_VERSION >= 52030001} // 52.30.1 - {const} metadata_conv: PAVMetadataConv; - {$IFEND} - (* private fields *) next: PAVInputFormat; end; @@ -608,11 +551,11 @@ type id: cint; (**< format-specific stream ID *) codec: PAVCodecContext; (**< codec context *) (** - * Real base framerate of the stream. - * This is the lowest framerate with which all timestamps can be + * Real base frame rate of the stream. + * This is the lowest frame rate with which all timestamps can be * represented accurately (it is the least common multiple of all - * framerates in the stream). Note, this value is just a guess! - * For example, if the time base is 1/90000 and all frames have either + * frame rates in the stream). Note, this value is just a guess! + * For example if the timebase is 1/90000 and all frames have either * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. *) r_frame_rate: TAVRational; @@ -629,7 +572,7 @@ type (** * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. For fixed-fps content, - * time base should be 1/framerate and timestamp increments should be 1. + * time base should be 1/frame rate and timestamp increments should be 1. *) time_base: TAVRational; pts_wrap_bits: cint; (* number of bits in pts (used for wrapping control) *) @@ -656,9 +599,7 @@ type *) duration: cint64; - {$IF LIBAVFORMAT_VERSION_MAJOR < 53} - language: array [0..3] of PAnsiChar; (* ISO 639-2/B 3-letter language code (empty string if undefined) *) - {$IFEND} + language: array [0..3] of PAnsiChar; (* ISO 639 3-letter language code (empty string if undefined) *) (* av_read_frame() support *) need_parsing: TAVStreamParseType; @@ -679,7 +620,7 @@ type unused: array [0..4] of cint64; {$IFEND} - {$IF (LIBAVFORMAT_VERSION >= 52006000) and (LIBAVFORMAT_VERSION_MAJOR < 53)} // 52.6.0 - 53.0.0 + {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0 filename: PAnsiChar; (**< source filename of the stream *) {$IFEND} @@ -712,25 +653,6 @@ type cur_len: cint; cur_pkt: TAVPacket; {$IFEND} - - {$IF LIBAVFORMAT_VERSION >= 52030000} // > 52.30.0 - // Timestamp generation support: - (** - * Timestamp corresponding to the last dts sync point. - * - * Initialized when AVCodecParserContext.dts_sync_point >= 0 and - * a DTS is received from the underlying container. Otherwise set to - * AV_NOPTS_VALUE by default. - *) - reference_dts: cint64; - {$IFEND} - {$IF LIBAVFORMAT_VERSION >= 52034000} // > 52.34.0 - (** - * Number of packets to buffer for codec probing - * NOT PART OF PUBLIC API - *) - probe_packets: cint; - {$IFEND} end; (** @@ -741,7 +663,7 @@ type * sizeof(AVFormatContext) must not be used outside libav*. *) TAVFormatContext = record - av_class: PAVClass; (**< Set by avformat_alloc_context. *) + av_class: PAVClass; (**< Set by av_alloc_format_context. *) (* Can only be iformat or oformat, not both at the same time. *) iformat: PAVInputFormat; oformat: PAVOutputFormat; @@ -758,7 +680,6 @@ type filename: array [0..1023] of AnsiChar; (* input or output filename *) (* stream info *) timestamp: cint64; - {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 title: array [0..511] of AnsiChar; author: array [0..511] of AnsiChar; copyright: array [0..511] of AnsiChar; @@ -767,7 +688,6 @@ type year: cint; (**< ID3 year, 0 if none *) track: cint; (**< track number, 0 if none *) genre: array [0..31] of AnsiChar; (**< ID3 genre *) - {$IFEND} ctx_flags: cint; (**< Format-specific flags, see AVFMTCTX_xx *) (* private data for pts handling (do not modify directly). *) @@ -815,7 +735,7 @@ type loop_input: cint; {$IF LIBAVFORMAT_VERSION >= 50006000} // 50.6.0 - (** decoding: size of data to probe; encoding: unused. *) + (** Decoding: size of data to probe; encoding: unused. *) probesize: cuint; {$IFEND} @@ -855,8 +775,8 @@ type {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 (** - * Maximum amount of memory in bytes to use for the index of each stream. - * If the index exceeds this size, entries will be discarded as + * Maximum amount of memory in bytes to use per stream for the index. + * If the needed index exceeds this size, entries will be discarded as * needed to maintain a smaller size. This can lead to slower or less * accurate seeking (depends on demuxer). * Demuxers for which a full in-memory index is mandatory will ignore @@ -913,10 +833,8 @@ type *) TAVProgram = record id : cint; - {$IF LIBAVFORMAT_VERSION < 53000000} // 53.00.0 provider_name : PAnsiChar; ///< network name for DVB streams name : PAnsiChar; ///< service name for DVB streams - {$IFEND} flags : cint; discard : TAVDiscard; ///< selects which program to discard and which to feed to the caller {$IF LIBAVFORMAT_VERSION >= 51016000} // 51.16.0 @@ -990,18 +908,8 @@ var {$IFEND} {$IF LIBAVFORMAT_VERSION >= 52003000} // 52.3.0 -(** - * If f is NULL, returns the first registered input format, - * if f is non-NULL, returns the next registered input format after f - * or NULL if f is the last one. - *) function av_iformat_next(f: PAVInputFormat): PAVInputFormat; cdecl; external av__format; -(** - * If f is NULL, returns the first registered output format, - * if f is non-NULL, returns the next registered input format after f - * or NULL if f is the last one. - *) function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; cdecl; external av__format; {$IFEND} @@ -1009,8 +917,8 @@ function av_oformat_next(f: PAVOutputFormat): PAVOutputFormat; function av_guess_image2_codec(filename: {const} PAnsiChar): TCodecID; cdecl; external av__format; -(* XXX: Use automatic init with either ELF sections or C file parser *) -(* modules. *) +(* XXX: use automatic init with either ELF sections or C file parser *) +(* modules *) (* utils.c *) procedure av_register_input_format(format: PAVInputFormat); @@ -1098,7 +1006,7 @@ procedure av_pkt_dump_log(avcl: Pointer; level: cint; pkt: PAVPacket; dump_paylo * * @see av_register_input_format() * @see av_register_output_format() - * @see av_register_protocol() + * @see register_protocol() *) procedure av_register_all(); cdecl; external av__format; @@ -1154,28 +1062,18 @@ function av_open_input_file(var ic_ptr: PAVFormatContext; filename: PAnsiChar; ap: PAVFormatParameters): cint; cdecl; external av__format; -{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0 (** * Allocate an AVFormatContext. * Can be freed with av_free() but do not forget to free everything you * explicitly allocated as well! *) -function avformat_alloc_context(): PAVFormatContext; - cdecl; external av__format; -{$ELSE} - {$IF LIBAVFORMAT_VERSION_MAJOR < 53} -(** - * @deprecated Use avformat_alloc_context() instead. - *) function av_alloc_format_context(): PAVFormatContext; cdecl; external av__format; - {$IFEND} -{$IFEND} (** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This - * function also computes the real framerate in case of MPEG-2 repeat + * function also computes the real frame rate in case of MPEG-2 repeat * frame mode. * The logical file position is not changed by this function; * examined packets may be buffered for later processing. @@ -1213,7 +1111,7 @@ function av_read_packet(s: PAVFormatContext; var pkt: TAVPacket): cint; * then it contains one frame. * * pkt->pts, pkt->dts and pkt->duration are always set to correct - * values in AVStream.time_base units (and guessed if the format cannot + * values in AVStream.timebase units (and guessed if the format cannot * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format * has B-frames, so it is better to rely on pkt->dts if you do not * decompress the payload. @@ -1224,7 +1122,7 @@ function av_read_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; cdecl; external av__format; (** - * Seek to the keyframe at timestamp. + * Seek to the key frame at timestamp. * 'timestamp' in 'stream_index'. * @param stream_index If stream_index is (-1), a default * stream is selected, and timestamp is automatically converted @@ -1238,51 +1136,15 @@ function av_seek_frame(s: PAVFormatContext; stream_index: cint; timestamp: cint6 flags: cint): cint; cdecl; external av__format; -{$IF LIBAVFORMAT_VERSION >= 52026000} // 52.26.0 (** - * Seek to timestamp ts. - * Seeking will be done so that the point from which all active streams - * can be presented successfully will be closest to ts and within min/max_ts. - * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. - * - * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in byte and - * are the file position (this may not be supported by all demuxers). - * If flags contain AVSEEK_FLAG_FRAME then all timestamps are in frames - * in the stream with stream_index (this may not be supported by all demuxers). - * Otherwise all timestamps are in units of the stream selected by stream_index - * or if stream_index is -1, in AV_TIME_BASE units. - * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as - * keyframes (this may not be supported by all demuxers). - * - * @param stream_index index of the stream which is used as time base reference. - * @param min_ts smallest acceptable timestamp - * @param ts target timestamp - * @param max_ts largest acceptable timestamp - * @param flags flags - * @returns >=0 on success, error code otherwise - * - * @NOTE This is part of the new seek API which is still under construction. - * Thus do not use this yet. It may change at any time, do not expect - * ABI compatibility yet! - *) -function avformat_seek_file(s: PAVFormatContext; - stream_index: cint; - min_ts: cint64; - ts: cint64; - max_ts: cint64; - flags: cint): cint; - cdecl; external av__format; -{$IFEND} - -(** - * Start playing a network-based stream (e.g. RTSP stream) at the + * Start playing a network based stream (e.g. RTSP stream) at the * current position. *) function av_read_play(s: PAVFormatContext): cint; cdecl; external av__format; (** - * Pause a network-based stream (e.g. RTSP stream). + * Pause a network based stream (e.g. RTSP stream). * * Use av_read_play() to resume it. *) @@ -1377,7 +1239,7 @@ function av_index_search_timestamp(st: PAVStream; timestamp: cint64; flags: cint {$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0 (** * Ensures the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows + * AVFormatContext.max_index_size, by discarding entries if it grows * too large. * This function is not part of the public API and should only be called * by demuxers. @@ -1475,7 +1337,7 @@ function av_write_frame(s: PAVFormatContext; var pkt: TAVPacket): cint; * Writes a packet to an output media file ensuring correct interleaving. * * The packet must contain one audio or video frame. - * If the packets are already correctly interleaved, the application should + * If the packets are already correctly interleaved the application should * call av_write_frame() instead as it is slightly faster. It is also important * to keep in mind that completely non-interleaved input will need huge amounts * of memory to interleave with this, so it is preferable to interleave at the @@ -1493,7 +1355,7 @@ function av_interleaved_write_frame(s: PAVFormatContext; var pkt: TAVPacket): ci * Interleave a packet per dts in an output media file. * * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it. Note that calling av_free_packet() + * function, so they cannot be used after it, note calling av_free_packet() * on them is still safe. * * @param s media file handle @@ -1508,24 +1370,6 @@ function av_interleave_packet_per_dts(s: PAVFormatContext; _out: PAVPacket; pkt: PAVPacket; flush: cint): cint; cdecl; external av__format; -{$IF LIBAVFORMAT_VERSION >= 52025000} // 52.25.0 -(** - * Add packet to AVFormatContext->packet_buffer list, determining its - * interleaved position using compare() function argument. - * - * This function is not part of the public API and should only be called - * by muxers using their own interleave function. - *) -{ -procedure ff_interleave_add_packet(s: PAVFormatContext; - pkt: PAVPacket; - compare: function(para1: PAVFormatContext; - para2: PAVPacket; - para3: PAVPacket): cint); - cdecl; external av__format; -} -{$IFEND} - (** * @brief Write the stream trailer to an output media file and * free the file private data. @@ -1552,7 +1396,7 @@ function parse_image_size(width_ptr: PCint; height_ptr: PCint; {$IF LIBAVFORMAT_VERSION_MAJOR < 53} (** - * Converts framerate from a string to a fraction. + * Converts frame rate from string to a fraction. * @deprecated Use av_parse_video_frame_rate instead. *) function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; @@ -1561,7 +1405,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; {$IFEND} (** - * Parses datestr and returns a corresponding number of microseconds. + * Parses \p datestr and returns a corresponding number of microseconds. * @param datestr String representing a date or a duration. * - If a date the syntax is: * @code @@ -1572,7 +1416,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; * If the year-month-day part is not specified it takes the current * year-month-day. * Returns the number of microseconds since 1st of January, 1970 up to - * the time of the parsed date or INT64_MIN if datestr cannot be + * the time of the parsed date or INT64_MIN if \p datestr cannot be * successfully parsed. * - If a duration the syntax is: * @code @@ -1580,10 +1424,10 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint; * [-]S+[.m...] * @endcode * Returns the number of microseconds contained in a time interval - * with the specified duration or INT64_MIN if datestr cannot be + * with the specified duration or INT64_MIN if \p datestr cannot be * successfully parsed. - * @param duration Flag which tells how to interpret datestr, if - * not zero datestr is interpreted as a duration, otherwise as a + * @param duration Flag which tells how to interpret \p datestr, if + * not zero \p datestr is interpreted as a duration, otherwise as a * date. *) function parse_date(datestr: PAnsiChar; duration: cint): cint64; @@ -1600,11 +1444,7 @@ const function ffm_read_write_index(fd: cint): cint64; cdecl; external av__format; -{$IF LIBAVFORMAT_VERSION < 52027000} // 52.27.0 procedure ffm_write_write_index(fd: cint; pos: cint64); -{$ELSE} -function ffm_write_write_index(fd: cint; pos: cint64): cint; -{$IFEND} cdecl; external av__format; procedure ffm_set_write_index(s: PAVFormatContext; pos: cint64; file_size: cint64); @@ -1620,7 +1460,7 @@ function find_info_tag(arg: PAnsiChar; arg_size: cint; tag1: PAnsiChar; info: PA cdecl; external av__format; (** - * Returns in 'buf' the path with '%d' replaced by a number. + * Returns in 'buf' the path with '%d' replaced by number. * * Also handles the '%0nd' format where 'n' is the total number * of digits and '%%'. @@ -1686,12 +1526,10 @@ begin end; {$IFEND} -{$IF LIBAVCODEC_VERSION < 52032000} // < 52.32.0 procedure av_free_packet(pkt: PAVPacket); begin if ((pkt <> nil) and (@pkt^.destruct <> nil)) then pkt^.destruct(pkt); end; -{$IFEND} end. diff --git a/unicode/src/lib/ffmpeg/avio.pas b/unicode/src/lib/ffmpeg/avio.pas index dc0a330b..33778206 100644 --- a/unicode/src/lib/ffmpeg/avio.pas +++ b/unicode/src/lib/ffmpeg/avio.pas @@ -27,12 +27,7 @@ (* * Conversion of libavformat/avio.h - * unbuffered I/O operations - * revision 16100, Sat Dec 13 13:39:13 2008 UTC - * update Tue, Jun 10 01:00:00 2009 UTC - * - * @warning This file has to be considered an internal but installed - * header, so it should not be directly included in your projects. + * revision 16100, Sat Dec 13 13:39:13 2008 UTC *) unit avio; @@ -108,7 +103,6 @@ type name: PAnsiChar; url_open: function (h: PURLContext; filename: {const} PAnsiChar; flags: cint): cint; cdecl; url_read: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; - url_read_complete: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; url_write: function (h: PURLContext; buf: PByteArray; size: cint): cint; cdecl; url_seek: function (h: PURLContext; pos: cint64; whence: cint): cint64; cdecl; url_close: function (h: PURLContext): cint; cdecl; @@ -186,16 +180,6 @@ function url_exist(filename: {const} PAnsiChar): cint; cdecl; external av__format; function url_filesize (h: PURLContext): cint64; cdecl; external av__format; -{ - * Return the file descriptor associated with this URL. For RTP, this - * will return only the RTP file descriptor, not the RTCP file descriptor. - * To get both, use rtp_get_file_handles(). - * - * @return the file descriptor associated with this URL, or <0 on error. -} -(* not implemented *) -function url_get_file_handle(h: PURLContext): cint; - cdecl; external av__format; (** * Return the maximum packet size associated to packetized file @@ -256,34 +240,19 @@ function av_url_read_seek(h: PURLContext; stream_index: cint; cdecl; external av__format; {$IFEND} -(** +{ var -{$IF LIBAVFORMAT_VERSION_MAJOR < 53} first_protocol: PURLProtocol; external av__format; -{$IFEND} url_interrupt_cb: PURLInterruptCB; external av__format; -**) - -{ -* If protocol is NULL, returns the first registered protocol, -* if protocol is non-NULL, returns the next registered protocol after protocol, -* or NULL if protocol is the last one. } + {$IF LIBAVFORMAT_VERSION >= 52002000} // 52.2.0 function av_protocol_next(p: PURLProtocol): PURLProtocol; cdecl; external av__format; {$IFEND} -{$IF LIBAVFORMAT_VERSION <= 52028000} // 52.28.0 -(** - * @deprecated Use av_register_protocol() instead. - *) function register_protocol (protocol: PURLProtocol): cint; cdecl; external av__format; -{$ELSE} -function av_register_protocol (protocol: PURLProtocol): cint; - cdecl; external av__format; -{$IFEND} type TReadWriteFunc = function (opaque: Pointer; buf: PByteArray; buf_size: cint): cint; cdecl; @@ -552,7 +521,7 @@ function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray; {$IFEND} function get_checksum(s: PByteIOContext): culong; cdecl; external av__format; -procedure init_gsum(s: PByteIOContext; +procedure init_checksum(s: PByteIOContext; update_checksum: pointer; checksum: culong); cdecl; external av__format; @@ -562,11 +531,9 @@ function udp_set_remote_url(h: PURLContext; uri: {const} PAnsiChar): cint; cdecl; external av__format; function udp_get_local_port(h: PURLContext): cint; cdecl; external av__format; -{$IF LIBAVFORMAT_VERSION_MAJOR <= 52} function udp_get_file_handle(h: PURLContext): cint; cdecl; external av__format; -{$IFEND} - + implementation function url_is_streamed(s: PByteIOContext): cint; diff --git a/unicode/src/lib/ffmpeg/avutil.pas b/unicode/src/lib/ffmpeg/avutil.pas index 6a93ea12..6de35f1b 100644 --- a/unicode/src/lib/ffmpeg/avutil.pas +++ b/unicode/src/lib/ffmpeg/avutil.pas @@ -29,21 +29,14 @@ * * libavutil/avutil.h: * Min. version: 49.0.1, revision 6577, Sat Oct 7 15:30:46 2006 UTC - * Max. version: 49.14.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC + * Max. version: 49.14.0, revision 16912, Sun Feb 1 02:00:19 2009 UTC * * libavutil/mem.h: - * revision 16590, Tue Jan 13 23:44:16 2009 UTC + * revision 16590, Tue Jan 13 23:44:16 2009 UTC * * libavutil/log.h: - * revision 16571, Tue Jan 13 00:14:43 2009 UTC + * revision 16571, Tue Jan 13 00:14:43 2009 UTC *) -{ - Update changes auf avutil.h, mem.h and log.h - Max. version 50.03.0, Tue, Jun 09 24:00:00 2009 UTC - include/keep pixfmt.h (change in revision 50.01.0) - Maybe, the pixelformats are not needed, but it has not been checked. - log.h is only partial. -} unit avutil; @@ -69,8 +62,8 @@ uses const (* Max. supported version by this header *) - LIBAVUTIL_MAX_VERSION_MAJOR = 50; - LIBAVUTIL_MAX_VERSION_MINOR = 3; + LIBAVUTIL_MAX_VERSION_MAJOR = 49; + LIBAVUTIL_MAX_VERSION_MINOR = 14; LIBAVUTIL_MAX_VERSION_RELEASE = 0; LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -119,14 +112,6 @@ type * components stored in AVFrame.data[1] should be in the range 0..255. * This is important as many custom PAL8 video codecs that were designed * to run on the IBM VGA graphics adapter use 6-bit palette components. - * - * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like - * for pal8. This palette is filled in automatically by the function - * allocating the picture. - * - * Note, make sure that all newly added big endian formats have pix_fmt&1==1 - * and that all newly added little endian formats have pix_fmt&1==0 - * this allows simpler detection of big vs little endian. *) PAVPixelFormat = ^TAVPixelFormat; @@ -138,15 +123,11 @@ type PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) -{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 PIX_FMT_RGB32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8R 8G 8B(lsb), in CPU endianness -{$IFEND} PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) -{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0 PIX_FMT_RGB565, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), in CPU endianness PIX_FMT_RGB555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), in CPU endianness, most significant bit to 0 -{$IFEND} PIX_FMT_GRAY8, ///< Y , 8bpp PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white @@ -154,17 +135,13 @@ type PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG) PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG) PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG) - PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing(xvmc_render.h) PIX_FMT_XVMC_MPEG2_IDCT, PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 -{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 PIX_FMT_BGR32, ///< packed RGB 8:8:8, 32bpp, (msb)8A 8B 8G 8R(lsb), in CPU endianness -{$IFEND} -{$IF LIBAVUTIL_VERSION <= 50000000} // 50.00.0 PIX_FMT_BGR565, ///< packed RGB 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), in CPU endianness PIX_FMT_BGR555, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), in CPU endianness, most significant bit to 1 -{$IFEND} PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) PIX_FMT_BGR4, ///< packed RGB 1:2:1, 4bpp, (msb)1B 2G 1R(lsb) PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) @@ -173,15 +150,10 @@ type PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 for UV PIX_FMT_NV21, ///< as above, but U and V bytes are swapped -{$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 + PIX_FMT_RGB32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8R 8G 8B 8A(lsb), in CPU endianness PIX_FMT_BGR32_1, ///< packed RGB 8:8:8, 32bpp, (msb)8B 8G 8R 8A(lsb), in CPU endianness -{$ELSE} // 50.02.0 - PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... - PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... - PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... - PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... -{$IFEND} + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) @@ -192,74 +164,23 @@ type PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers -{$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 - PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, big-endian - PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, little-endian -{$IFEND} -{$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 - PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian - PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian - PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 - PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 - - PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian - PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian - PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 - PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 - - PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers - PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers - PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers -{$IFEND} PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions ); const {$ifdef WORDS_BIGENDIAN} - {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 - PIX_FMT_RGBA = PIX_FMT_RGB32_1; - PIX_FMT_BGRA = PIX_FMT_BGR32_1; - PIX_FMT_ARGB = PIX_FMT_RGB32; - PIX_FMT_ABGR = PIX_FMT_BGR32; - {$ELSE} // 50.02.0 - PIX_FMT_RGB32 = PIX_FMT_ARGB; - PIX_FMT_RGB32_1 = PIX_FMT_RGBA; - PIX_FMT_BGR32 = PIX_FMT_ABGR; - PIX_FMT_BGR32_1 = PIX_FMT_BGRA; - {$IFEND} - PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; - {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 - PIX_FMT_RGB48 = PIX_FMT_RGB48BE; - {$IFEND} - {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 - PIX_FMT_RGB565 = PIX_FMT_RGB565BE; - PIX_FMT_RGB555 = PIX_FMT_RGB555BE; - PIX_FMT_BGR565 = PIX_FMT_BGR565BE; - PIX_FMT_BGR555 = PIX_FMT_BGR555BE - {$IFEND} + PIX_FMT_RGBA = PIX_FMT_RGB32_1; + PIX_FMT_BGRA = PIX_FMT_BGR32_1; + PIX_FMT_ARGB = PIX_FMT_RGB32; + PIX_FMT_ABGR = PIX_FMT_BGR32; + PIX_FMT_GRAY16 = PIX_FMT_GRAY16BE; {$else} - {$IF LIBAVUTIL_VERSION <= 50001000} // 50.01.0 - PIX_FMT_RGBA = PIX_FMT_BGR32; - PIX_FMT_BGRA = PIX_FMT_RGB32; - PIX_FMT_ARGB = PIX_FMT_BGR32_1; - PIX_FMT_ABGR = PIX_FMT_RGB32_1; - {$ELSE} // 50.02.0 - PIX_FMT_RGB32 = PIX_FMT_BGRA; - PIX_FMT_RGB32_1 = PIX_FMT_ABGR; - PIX_FMT_BGR32 = PIX_FMT_RGBA; - PIX_FMT_BGR32_1 = PIX_FMT_ARGB; - {$IFEND} - PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; - {$IF LIBAVUTIL_VERSION >= 49015000} // 49.15.0 - PIX_FMT_RGB48 = PIX_FMT_RGB48LE; - {$IFEND} - {$IF LIBAVUTIL_VERSION >= 50001000} // 50.01.0 - PIX_FMT_RGB565 = PIX_FMT_RGB565LE; - PIX_FMT_RGB555 = PIX_FMT_RGB555LE; - PIX_FMT_BGR565 = PIX_FMT_BGR565LE; - PIX_FMT_BGR555 = PIX_FMT_BGR555LE; - {$IFEND} -{$ENDIF} + PIX_FMT_RGBA = PIX_FMT_BGR32; + PIX_FMT_BGRA = PIX_FMT_RGB32; + PIX_FMT_ARGB = PIX_FMT_BGR32_1; + PIX_FMT_ABGR = PIX_FMT_RGB32_1; + PIX_FMT_GRAY16 = PIX_FMT_GRAY16LE; +{$endif} {$IF LIBAVUTIL_VERSION_MAJOR < 50} // 50.0.0 PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411; @@ -267,41 +188,40 @@ const PIX_FMT_YUV422 = PIX_FMT_YUYV422; {$IFEND} -(* libavutil/common.h *) // until now MKTAG is all from common.h KMS 9/6/2009 +(* common.h *) -function MKTAG(a, b, c, d: AnsiChar): integer; +function MKTAG(a,b,c,d: AnsiChar): integer; -(* libavutil/mem.h *) -(* memory handling functions *) +(* mem.h *) (** - * Allocates a block of size bytes with alignment suitable for all + * Allocate a block of \p size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU). * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if the block cannot - * be allocated. + * @return Pointer to the allocated block, NULL if it cannot allocate + * it. * @see av_mallocz() *) function av_malloc(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** - * Allocates or reallocates a block of memory. - * If ptr is NULL and size > 0, allocates a new block. If \p - * size is zero, frees the memory block pointed to by ptr. + * Allocate or reallocate a block of memory. + * If \p ptr is NULL and \p size > 0, allocate a new block. If \p + * size is zero, free the memory block pointed by \p ptr. * @param size Size in bytes for the memory block to be allocated or * reallocated. * @param ptr Pointer to a memory block already allocated with * av_malloc(z)() or av_realloc() or NULL. - * @return Pointer to a newly reallocated block or NULL if the block - * cannot be allocated or the function is used to free the memory block. + * @return Pointer to a newly reallocated block or NULL if it cannot + * reallocate or the function is used to free the memory block. * @see av_fast_realloc() *) function av_realloc(ptr: pointer; size: cuint): pointer; cdecl; external av__util; {av_alloc_size(2)} (** - * Frees a memory block which has been allocated with av_malloc(z)() or + * Free a memory block which has been allocated with av_malloc(z)() or * av_realloc(). * @param ptr Pointer to the memory block which should be freed. * @note ptr = NULL is explicitly allowed. @@ -312,28 +232,29 @@ procedure av_free(ptr: pointer); cdecl; external av__util; (** - * Allocates a block of size bytes with alignment suitable for all + * Allocate a block of \p size bytes with alignment suitable for all * memory accesses (including vectors if available on the CPU) and - * zeroes all the bytes of the block. + * set to zeroes all the bytes of the block. * @param size Size in bytes for the memory block to be allocated. - * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @return Pointer to the allocated block, NULL if it cannot allocate + * it. * @see av_malloc() *) function av_mallocz(size: cuint): pointer; cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)} (** - * Duplicates the string s. - * @param s string to be duplicated. + * Duplicate the string \p s. + * @param s String to be duplicated. * @return Pointer to a newly allocated string containing a - * copy of \p s or NULL if the string cannot be allocated. + * copy of \p s or NULL if it cannot be allocated. *) function av_strdup({const} s: PAnsiChar): PAnsiChar; cdecl; external av__util; {av_malloc_attrib} (** - * Frees a memory block which has been allocated with av_malloc(z)() or - * av_realloc() and set the pointer pointing to it to NULL. + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set to NULL the pointer to it. * @param ptr Pointer to the pointer to the memory block which should * be freed. * @see av_free() @@ -341,7 +262,7 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar; procedure av_freep (ptr: pointer); cdecl; external av__util; -(* libavutil/log.h *) +(* log.h *) const {$IF LIBAVUTIL_VERSION_MAJOR < 50} @@ -356,26 +277,26 @@ const AV_LOG_QUIET = -8; (** - * Something went really wrong and we will crash now. + * something went really wrong and we will crash now *) AV_LOG_PANIC = 0; (** - * Something went wrong and recovery is not possible. - * For example, no header was found for a format which depends - * on headers or an illegal combination of parameters is used. + * something went wrong and recovery is not possible + * like no header in a format which depends on it or a combination + * of parameters which are not allowed *) AV_LOG_FATAL = 8; (** - * Something went wrong and cannot losslessly be recovered. - * However, not all future data is affected. + * something went wrong and cannot losslessly be recovered + * but not all future data is affected *) AV_LOG_ERROR = 16; (** - * Something somehow does not look correct. This may or may not - * lead to problems. An example would be the use of '-vstrict -2'. + * something somehow does not look correct / something which may or may not + * lead to some problems like use of -vstrict -2 *) AV_LOG_WARNING = 24; @@ -383,7 +304,7 @@ const AV_LOG_VERBOSE = 40; (** - * Stuff which is only useful for libav* developers. + * stuff which is only useful for libav* developers *) AV_LOG_DEBUG = 48; {$IFEND} @@ -396,9 +317,7 @@ procedure av_log_set_level(level: cint); implementation -(* libavutil/common.h *) - -function MKTAG(a, b, c, d: AnsiChar): integer; +function MKTAG(a,b,c,d: AnsiChar): integer; begin Result := (ord(a) or (ord(b) shl 8) or (ord(c) shl 16) or (ord(d) shl 24)); end; diff --git a/unicode/src/lib/ffmpeg/mathematics.pas b/unicode/src/lib/ffmpeg/mathematics.pas index 92ee0a5e..fb57ccea 100644 --- a/unicode/src/lib/ffmpeg/mathematics.pas +++ b/unicode/src/lib/ffmpeg/mathematics.pas @@ -27,9 +27,6 @@ (* * Conversion of libavutil/mathematics.h * revision 16844, Wed Jan 28 08:50:10 2009 UTC - * - * update, MiSchi, no code change - * Fri Jun 12 2009 21:50:00 UTC *) unit mathematics; @@ -58,11 +55,11 @@ const type TAVRounding = ( - AV_ROUND_ZERO = 0, ///< Round toward zero. - AV_ROUND_INF = 1, ///< Round away from zero. - AV_ROUND_DOWN = 2, ///< Round toward -infinity. - AV_ROUND_UP = 3, ///< Round toward +infinity. - AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero. + AV_ROUND_ZERO = 0, ///< Round toward zero + AV_ROUND_INF = 1, ///< Round away from zero + AV_ROUND_DOWN = 2, ///< Round toward -infinity + AV_ROUND_UP = 3, ///< Round toward +infinity + AV_ROUND_NEAR_INF = 5 ///< Round to nearest and halfway cases away from zero ); {$IF LIBAVUTIL_VERSION >= 49013000} // 49.13.0 @@ -93,3 +90,4 @@ function av_rescale_q (a: cint64; bq, cq: TAVRational): cint64; implementation end. + diff --git a/unicode/src/lib/ffmpeg/opt.pas b/unicode/src/lib/ffmpeg/opt.pas index a2e2cce9..833dc247 100644 --- a/unicode/src/lib/ffmpeg/opt.pas +++ b/unicode/src/lib/ffmpeg/opt.pas @@ -28,9 +28,6 @@ (* * Conversion of libavcodec/opt.h * revision 16912, Sun Feb 1 02:00:19 2009 UTC - * - * update, MiSchi, no code change - * Fri Jun 12 2009 21:50:00 UTC *) unit opt; @@ -112,8 +109,8 @@ type {$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0 (** - * Looks for an option in obj. Looks only for the options which - * have the flags set as specified in mask and flags (that is, + * Looks for an option in \p obj. Looks only for the options which + * have the flags set as specified in \p mask and \p flags (that is, * for which it is the case that opt->flags & mask == flags). * * @param[in] obj a pointer to a struct whose first element is a @@ -138,7 +135,7 @@ function av_set_string(obj: pointer; name: {const} PAnsiChar; val: {const} PAnsi {$IF LIBAVCODEC_VERSION >= 51059000} // 51.59.0 (** * @return a pointer to the AVOption corresponding to the field set or - * NULL if no matching AVOption exists, or if the value val is not + * NULL if no matching AVOption exists, or if the value \p val is not * valid * @see av_set_string3() *) @@ -170,11 +167,8 @@ function av_set_string2(obj: Pointer; name: {const} PAnsiChar; val: {const} PAns * @param alloc when 1 then the old value will be av_freed() and the * new av_strduped() * when 0 then no av_free() nor av_strdup() will be used - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR(ENOENT) if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid + * @return 0 if the value has been set, an AVERROR* error code if no + * matching option exists, or if the value \p val is not valid *) function av_set_string3(obj: Pointer; name: {const} PAnsiChar; val: {const} PAnsiChar; alloc: cint; out o_out: {const} PAVOption): cint; cdecl; external av__codec; diff --git a/unicode/src/lib/ffmpeg/rational.pas b/unicode/src/lib/ffmpeg/rational.pas index b940009d..6762aa26 100644 --- a/unicode/src/lib/ffmpeg/rational.pas +++ b/unicode/src/lib/ffmpeg/rational.pas @@ -28,9 +28,6 @@ (* * Conversion of libavutil/rational.h * revision 16912, Sun Feb 1 02:00:19 2009 UTC - * - * update, MiSchi, no code change - * Fri Jun 12 2009 22:20:00 UTC *) unit rational; @@ -138,20 +135,22 @@ function av_d2q(d: cdouble; max: cint): TAVRational; cdecl; external av__util; {av_const} {$IF LIBAVUTIL_VERSION >= 49011000} // 49.11.0 + (** - * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer - * than q1, 0 if they have the same distance. + * @return 1 if \q1 is nearer to \p q than \p q2, -1 if \p q2 is nearer + * than \p q1, 0 if they have the same distance. *) function av_nearer_q(q, q1, q2: TAVRational): cint; cdecl; external av__util; (** - * Finds the nearest value in q_list to q. + * Finds the nearest value in \p q_list to \p q. * @param q_list an array of rationals terminated by {0, 0} * @return the index of the nearest value found in the array *) function av_find_nearest_q_idx(q: TAVRational; q_list: {const} PAVRationalArray): cint; cdecl; external av__util; + {$IFEND} implementation diff --git a/unicode/src/lib/ffmpeg/swscale.pas b/unicode/src/lib/ffmpeg/swscale.pas index c0aabf45..965659d9 100644 --- a/unicode/src/lib/ffmpeg/swscale.pas +++ b/unicode/src/lib/ffmpeg/swscale.pas @@ -45,13 +45,12 @@ interface uses ctypes, avutil, - avcodec, UConfig; const (* Max. supported version by this header *) LIBSWSCALE_MAX_VERSION_MAJOR = 0; - LIBSWSCALE_MAX_VERSION_MINOR = 7; + LIBSWSCALE_MAX_VERSION_MINOR = 6; LIBSWSCALE_MAX_VERSION_RELEASE = 1; LIBSWSCALE_MAX_VERSION = (LIBSWSCALE_MAX_VERSION_MAJOR * VERSION_MAJOR) + (LIBSWSCALE_MAX_VERSION_MINOR * VERSION_MINOR) + @@ -79,7 +78,7 @@ function swscale_version(): cuint; {$IFEND} const - (* values for the flags, the stuff on the command line is different *) + {* values for the flags, the stuff on the command line is different *} SWS_FAST_BILINEAR = 1; SWS_BILINEAR = 2; SWS_BICUBIC = 4; @@ -99,10 +98,10 @@ const SWS_PRINT_INFO = $1000; - // the following 3 flags are not completely implemented - // internal chrominace subsampling info + //the following 3 flags are not completely implemented + //internal chrominace subsampling info SWS_FULL_CHR_H_INT = $2000; - // input subsampling info + //input subsampling info SWS_FULL_CHR_H_INP = $4000; SWS_DIRECT_BGR = $8000; SWS_ACCURATE_RND = $40000; @@ -124,14 +123,15 @@ const SWS_CS_SMPTE240M = 7; SWS_CS_DEFAULT = 5; + type // when used for filters they must have an odd number of elements // coeffs cannot be shared between vectors PSwsVector = ^TSwsVector; TSwsVector = record - coeff: PCdouble; // pointer to the list of coefficients - length: cint; // number of coefficients in the vector + coeff: PCdouble; + length: cint; end; // vectors can be shared @@ -148,179 +148,63 @@ type {internal structure} end; + procedure sws_freeContext(swsContext: PSwsContext); cdecl; external sw__scale; -(** - * Allocates and returns a SwsContext. You need it to perform - * scaling/conversion operations using sws_scale(). - * - * @param srcW the width of the source image - * @param srcH the height of the source image - * @param srcFormat the source image format - * @param dstW the width of the destination image - * @param dstH the height of the destination image - * @param dstFormat the destination image format - * @param flags specify which algorithm and options to use for rescaling - * @return a pointer to an allocated context, or NULL in case of error - *) function sws_getContext(srcW: cint; srcH: cint; srcFormat: TAVPixelFormat; - dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; - flags: cint; srcFilter: PSwsFilter; - dstFilter: PSwsFilter; param: PCdouble): PSwsContext; + dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; flags: cint; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; - -(** - * Scales the image slice in srcSlice and puts the resulting scaled - * slice in the image in dst. A slice is a sequence of consecutive - * rows in an image. - * - * @param context the scaling context previously created with - * sws_getContext() - * @param srcSlice the array containing the pointers to the planes of - * the source slice - * @param srcStride the array containing the strides for each plane of - * the source image - * @param srcSliceY the position in the source image of the slice to - * process, that is the number (counted starting from - * zero) in the image of the first row of the slice - * @param srcSliceH the height of the source slice, that is the number - * of rows in the slice - * @param dst the array containing the pointers to the planes of - * the destination image - * @param dstStride the array containing the strides for each plane of - * the destination image - * @return the height of the output slice - *) -function sws_scale(context: PSwsContext; srcSlice: PPCuint8Array; srcStride: PCintArray; - srcSliceY: cint; srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; +function sws_scale(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint; srcSliceH: cint; + dst: PPCuint8Array; dstStride: PCintArray): cint; cdecl; external sw__scale; - -{$IF LIBSWSCALE_VERSION_MAJOR < 1} -// deprecated. Use sws_scale() instead. -function sws_scale_ordered(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; - srcSliceY: cint; srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; +function sws_scale_ordered(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint; + srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint; cdecl; external sw__scale; deprecated; -{$IFEND} -(** - * @param inv_table the yuv2rgb coefficients, normally ff_yuv2rgb_coeffs[x] - * @param fullRange if 1 then the luma range is 0..255 if 0 it is 16..235 - * @return -1 if not supported - *) -function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadCintArray; - srcRange: cint; table: PQuadCintArray; dstRange: cint; +function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadCintArray; srcRange: cint; table: PQuadCintArray; dstRange: cint; brightness: cint; contrast: cint; saturation: cint): cint; cdecl; external sw__scale; - -(** - * @return -1 if not supported - *) -function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadCintArray; - var srcRange: cint; var table: PQuadCintArray; var dstRange: cint; +function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadCintArray; var srcRange: cint; var table: PQuadCintArray; var dstRange: cint; var brightness: cint; var contrast: cint; var saturation: cint): cint; cdecl; external sw__scale; - -(** - * Returns a normalized Gaussian curve used to filter stuff - * quality=3 is high quality, lower is lower quality. - *) function sws_getGaussianVec(variance: cdouble; quality: cdouble): PSwsVector; cdecl; external sw__scale; - -(** - * Allocates and returns a vector with length coefficients, all - * with the same value c. - *) function sws_getConstVec(c: cdouble; length: cint): PSwsVector; cdecl; external sw__scale; - -(** - * Allocates and returns a vector with just one coefficient, with - * value 1.0. - *) function sws_getIdentityVec: PSwsVector; cdecl; external sw__scale; - -(** - * Scales all the coefficients of a by the scalar value. - *) procedure sws_scaleVec(a: PSwsVector; scalar: cdouble); cdecl; external sw__scale; - -(** - * Scales all the coefficients of a so that their sum equals height. - *) procedure sws_normalizeVec(a: PSwsVector; height: cdouble); cdecl; external sw__scale; - procedure sws_convVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; - procedure sws_addVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; - procedure sws_subVec(a: PSwsVector; b: PSwsVector); cdecl; external sw__scale; - procedure sws_shiftVec(a: PSwsVector; shift: cint); cdecl; external sw__scale; - -(** - * Allocates and returns a clone of the vector a, that is a vector - * with the same coefficients as a. - *) function sws_cloneVec(a: PSwsVector): PSwsVector; cdecl; external sw__scale; -{$IF LIBSWSCALE_VERSION_MAJOR < 1} -// deprecated Use sws_printVec2() instead. - procedure sws_printVec(a: PSwsVector); - cdecl; external sw__scale; deprecated; -{$IFEND} - -{$IF LIBSWSCALE_VERSION >= 000007000} // >= 0.7.0 -(** - * Prints with av_log() a textual representation of the vector a - * if log_level <= av_log_level. - *) -procedure sws_printVec2(a: PSwsVector; - log_ctx: PAVClass; // PAVClass is declared in avcodec.pas - log_level: cint); cdecl; external sw__scale; -{$IFEND} - procedure sws_freeVec(a: PSwsVector); cdecl; external sw__scale; -function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat; - lumaSharpen: cfloat; chromaSharpen: cfloat; - chromaHShift: cfloat; chromaVShift: cfloat; - verbose: cint): PSwsFilter; +function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat; lumaSarpen: cfloat; chromaSharpen: cfloat; chromaHShift: cfloat; + chromaVShift: cfloat; verbose: cint): PSwsFilter; cdecl; external sw__scale; - procedure sws_freeFilter(filter: PSwsFilter); cdecl; external sw__scale; -(** - * Checks if context can be reused, otherwise reallocates a new - * one. - * - * If context is NULL, just calls sws_getContext() to get a new - * context. Otherwise, checks if the parameters are the ones already - * saved in context. If that is the case, returns the current - * context. Otherwise, frees context and gets a new context with - * the new parameters. - * - * Be warned that srcFilter and dstFilter are not checked, they - * are assumed to remain the same. - *) function sws_getCachedContext(context: PSwsContext; - srcW: cint; srcH: cint; srcFormat: TAVPixelFormat; - dstW: cint; dstH: cint; dstFormat: TAVPixelFormat; - flags: cint; srcFilter: PSwsFilter; - dstFilter: PSwsFilter; param: PCdouble): PSwsContext; + srcW: cint; srcH: cint; srcFormat: cint; + dstW: cint; dstH: cint; dstFormat: cint; flags: cint; + srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext; cdecl; external sw__scale; implementation diff --git a/unicode/src/media/UAudioDecoder_FFmpeg.pas b/unicode/src/media/UAudioDecoder_FFmpeg.pas index 97d8a8df..2d221f40 100644 --- a/unicode/src/media/UAudioDecoder_FFmpeg.pas +++ b/unicode/src/media/UAudioDecoder_FFmpeg.pas @@ -378,14 +378,14 @@ begin // try standard format SampleFormat := asfS16; end; - if CodecCtx^.channels > 255 then - Log.LogStatus('Error: CodecCtx^.channels > 255', 'TFFmpegDecodeStream.Open'); + FormatInfo := TAudioFormatInfo.Create( - byte(CodecCtx^.channels), + CodecCtx^.channels, CodecCtx^.sample_rate, SampleFormat ); + PacketQueue := TPacketQueue.Create(); // finally start the decode thread @@ -446,9 +446,7 @@ end; function TFFmpegDecodeStream.GetLength(): real; begin - // do not forget to consider the start_time value here - // there is a type size mismatch warnign because start_time and duration are cint64. - // So, in principle there could be an overflow when doing the sum. + // do not forget to consider the start_time value here Result := (FormatCtx^.start_time + FormatCtx^.duration) / AV_TIME_BASE; end; @@ -645,6 +643,7 @@ end; function TFFmpegDecodeStream.ParseLoop(): boolean; var Packet: TAVPacket; + StatusPacket: PAVPacket; SeekTarget: int64; ByteIOCtx: PByteIOContext; ErrorCode: integer; diff --git a/unicode/src/media/UAudioInput_Bass.pas b/unicode/src/media/UAudioInput_Bass.pas index ad6c3818..cf292c45 100644 --- a/unicode/src/media/UAudioInput_Bass.pas +++ b/unicode/src/media/UAudioInput_Bass.pas @@ -95,7 +95,7 @@ var * user - players associated with left/right channels *} function MicrophoneCallback(stream: HSTREAM; buffer: Pointer; - len: integer; inputDevice: Pointer): boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + len: Cardinal; inputDevice: Pointer): boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} begin AudioInputProcessor.HandleMicrophoneData(buffer, len, inputDevice); Result := true; diff --git a/unicode/src/media/UAudioInput_Portaudio.pas b/unicode/src/media/UAudioInput_Portaudio.pas index 31d2882b..53080a03 100644 --- a/unicode/src/media/UAudioInput_Portaudio.pas +++ b/unicode/src/media/UAudioInput_Portaudio.pas @@ -95,6 +95,7 @@ var Error: TPaError; inputParams: TPaStreamParameters; deviceInfo: PPaDeviceInfo; + SourceIndex: integer; begin Result := false; @@ -290,6 +291,8 @@ var sourceIndex: integer; sourceName: string; {$ENDIF} + cbPolls: integer; + cbWorks: boolean; begin Result := false; diff --git a/unicode/src/media/UAudioPlayback_SoftMixer.pas b/unicode/src/media/UAudioPlayback_SoftMixer.pas index c87e461d..c8da6bcd 100644 --- a/unicode/src/media/UAudioPlayback_SoftMixer.pas +++ b/unicode/src/media/UAudioPlayback_SoftMixer.pas @@ -51,7 +51,7 @@ type SampleBuffer: PByteArray; SampleBufferSize: integer; SampleBufferCount: integer; // number of available bytes in SampleBuffer - SampleBufferPos: integer; + SampleBufferPos: cardinal; SourceBuffer: PByteArray; SourceBufferSize: integer; @@ -564,8 +564,9 @@ var ConversionOutputSize: integer; // max. number of converted data (= buffer size) ConversionOutputCount: integer; // actual number of converted data SourceSize: integer; + RequestedSourceSize: integer; NeededSampleBufferSize: integer; - BytesNeeded: integer; + BytesNeeded, BytesAvail: integer; SourceFormatInfo, OutputFormatInfo: TAudioFormatInfo; SourceFrameSize, OutputFrameSize: integer; SkipOutputCount: integer; // number of output-data bytes to skip @@ -573,6 +574,7 @@ var FillCount: integer; // number of bytes to fill with padding data CopyCount: integer; PadFrame: PByteArray; + i: integer; begin Result := -1; diff --git a/unicode/src/media/UVideo.pas b/unicode/src/media/UVideo.pas index f55690b2..35f8ab4d 100644 --- a/unicode/src/media/UVideo.pas +++ b/unicode/src/media/UVideo.pas @@ -697,12 +697,6 @@ begin 0, fCodecContext^.Height, @(fAVFrameRGB.data), @(fAVFrameRGB.linesize)); {$ELSE} - // img_convert from lib/ffmpeg/avcodec.pas is actually deprecated. - // If ./configure does not find SWScale then this gives the error - // that the identifier img_convert is not known or similar. - // I think this should be removed, but am not sure whether there should - // be some other replacement or a warning, Therefore, I leave it for now. - // April 2009, mischi errnum := img_convert(PAVPicture(fAVFrameRGB), PIXEL_FMT_FFMPEG, PAVPicture(fAVFrame), fCodecContext^.pix_fmt, fCodecContext^.width, fCodecContext^.height); diff --git a/unicode/src/menu/UDisplay.pas b/unicode/src/menu/UDisplay.pas index f2eb2ced..3e653183 100644 --- a/unicode/src/menu/UDisplay.pas +++ b/unicode/src/menu/UDisplay.pas @@ -45,71 +45,43 @@ type TDisplay = class private //fade-to-black-hack - BlackScreen: boolean; + BlackScreen: Boolean; - FadeEnabled: boolean; // true if fading is enabled - FadeFailed: boolean; // true if fading is possible (enough memory, etc.) - FadeState: integer; // fading state, 0 means that the fade texture must be initialized - LastFadeTime: cardinal; // last fade update time + FadeEnabled: Boolean; // true if fading is enabled + FadeFailed: Boolean; // true if fading is possible (enough memory, etc.) + FadeState: integer; // fading state, 0 means that the fade texture must be initialized + LastFadeTime: Cardinal; // last fade update time - FadeTex: array[1..2] of GLuint; - - FPSCounter: cardinal; - LastFPS: cardinal; - NextFPSSwap: cardinal; + FadeTex: array[1..2] of GLuint; - OSD_LastError: string; + FPSCounter : Cardinal; + LastFPS : Cardinal; + NextFPSSwap : Cardinal; - { software cursor data } - Cursor_X: double; - Cursor_Y: double; - Cursor_Pressed: boolean; - Cursor_HiddenByScreen: boolean; // hides software cursor and deactivate auto fade in - - // used for cursor fade out when there is no movement - Cursor_Visible: boolean; - Cursor_LastMove: cardinal; - Cursor_Fade: boolean; + OSD_LastError : String; procedure DrawDebugInformation; public - NextScreen: PMenu; - CurrentScreen: PMenu; + NextScreen : PMenu; + CurrentScreen : PMenu; //popup data NextScreenWithCheck: Pmenu; - CheckOK: boolean; + CheckOK : Boolean; // FIXME: Fade is set to 0 in UMain and other files but not used here anymore. - Fade: real; + Fade : Real; constructor Create; destructor Destroy; override; procedure SaveScreenShot; - function Draw: boolean; - - { sets SDL_ShowCursor depending on options set in Ini } - procedure SetCursor; - - { called when cursor moves, positioning of software cursor } - procedure MoveCursor(X, Y: double; Pressed: boolean); - - - { draws software cursor } - procedure DrawCursor; + function Draw: Boolean; end; var - Display: TDisplay; - -const - { constants for software cursor effects - time in milliseconds } - Cursor_FadeIn_Time = 500; // seconds the fade in effect lasts - Cursor_FadeOut_Time = 2000; // seconds the fade out effect lasts - Cursor_AutoHide_Time = 5000; // seconds until auto fade out starts if there is no mouse movement + Display: TDisplay; implementation @@ -132,15 +104,15 @@ begin inherited Create; //popup hack - CheckOK := false; + CheckOK := False; NextScreen := nil; NextScreenWithCheck := nil; - BlackScreen := false; + BlackScreen := False; // fade mod - FadeState := 0; + FadeState := 0; FadeEnabled := (Ini.ScreenFade = 1); - FadeFailed := false; + FadeFailed:= false; glGenTextures(2, @FadeTex); @@ -153,15 +125,6 @@ begin //Set LastError for OSD to No Error OSD_LastError := 'No Errors'; - - // software cursor default values - Cursor_LastMove := 0; - Cursor_Visible := false; - Cursor_Pressed := false; - Cursor_X := -1; - Cursor_Y := -1; - Cursor_Fade := false; - Cursor_HiddenByScreen := true; end; destructor TDisplay.Destroy; @@ -170,14 +133,14 @@ begin inherited Destroy; end; -function TDisplay.Draw: boolean; +function TDisplay.Draw: Boolean; var - S: integer; - FadeStateSquare: real; - currentTime: cardinal; - glError: glEnum; + S: integer; + FadeStateSquare: Real; + currentTime: Cardinal; + glError: glEnum; begin - Result := true; + Result := True; //We don't need this here anymore, //Because the background care about cleaning the buffers @@ -203,12 +166,12 @@ begin begin NextScreen := NextScreenWithCheck; NextScreenWithCheck := nil; - CheckOk := false; + CheckOk := False; end else begin // on end of game fade to black before exit - BlackScreen := true; + BlackScreen := True; end; end; @@ -225,16 +188,16 @@ begin // fade mod FadeState := 0; if ((Ini.ScreenFade = 1) and (not FadeFailed)) then - FadeEnabled := true + FadeEnabled := True else if (Ini.ScreenFade = 0) then - FadeEnabled := false; + FadeEnabled := False; end else begin // disable fading if initialization failed if (FadeEnabled and FadeFailed) then begin - FadeEnabled := false; + FadeEnabled := False; end; if (FadeEnabled and not FadeFailed) then @@ -312,7 +275,7 @@ begin glDisable(GL_BLEND); glDisable(GL_TEXTURE_2D); end -// blackscreen hack + // blackscreen hack else if not BlackScreen then begin NextScreen.OnShow; @@ -323,7 +286,7 @@ begin // fade out complete... FadeState := 0; CurrentScreen.onHide; - CurrentScreen.ShowFinish := false; + CurrentScreen.ShowFinish := False; CurrentScreen := NextScreen; NextScreen := nil; if not BlackScreen then @@ -333,172 +296,16 @@ begin end else begin - Result := false; + Result := False; Break; end; end; end; // if -// Draw OSD only on first Screen if Debug Mode is enabled + //Draw OSD only on first Screen if Debug Mode is enabled if ((Ini.Debug = 1) or (Params.Debug)) and (S = 1) then DrawDebugInformation; end; // for - - if not BlackScreen then - DrawCursor; -end; - -{ sets SDL_ShowCursor depending on options set in Ini } -procedure TDisplay.SetCursor; -var - Cursor: Integer; -begin - Cursor := 0; - - if (CurrentScreen <> @ScreenSing) or (Cursor_HiddenByScreen) then - begin // hide cursor on singscreen - if (Ini.Mouse = 0) and (Ini.FullScreen = 0) then - // show sdl (os) cursor in window mode even when mouse support is off - Cursor := 1 - else if (Ini.Mouse = 1) then - // show sdl (os) cursor when hardware cursor is selected - Cursor := 1; - - if (Ini.Mouse <> 2) then - Cursor_HiddenByScreen := false; - end - else if (Ini.Mouse <> 2) then - Cursor_HiddenByScreen := true; - - - SDL_ShowCursor(Cursor); - - if (Ini.Mouse = 2) then - begin - if Cursor_HiddenByScreen then - begin - // show software cursor - Cursor_HiddenByScreen := false; - Cursor_Visible := false; - Cursor_Fade := false; - end - else if (CurrentScreen = @ScreenSing) then - begin - // hide software cursor in singscreen - Cursor_HiddenByScreen := true; - Cursor_Visible := false; - Cursor_Fade := false; - end; - end; -end; - -{ called when cursor moves, positioning of software cursor } -procedure TDisplay.MoveCursor(X, Y: double; Pressed: boolean); -var - Ticks: cardinal; -begin - if (Ini.Mouse = 2) and - ((X <> Cursor_X) or (Y <> Cursor_Y) or (Pressed <> Cursor_Pressed)) then - begin - Cursor_X := X; - Cursor_Y := Y; - Cursor_Pressed := Pressed; - - Ticks := SDL_GetTicks; - - { fade in on movement (or button press) if not first movement } - if (not Cursor_Visible) and (Cursor_LastMove <> 0) then - begin - if Cursor_Fade then // we use a trick here to consider progress of fade out - Cursor_LastMove := Ticks - round(Cursor_FadeIn_Time * (1 - (Ticks - Cursor_LastMove)/Cursor_FadeOut_Time)) - else - Cursor_LastMove := Ticks; - - Cursor_Visible := true; - Cursor_Fade := true; - end - else if not Cursor_Fade then - begin - Cursor_LastMove := Ticks; - end; - end; -end; - -{ draws software cursor } -procedure TDisplay.DrawCursor; -var - Alpha: single; - Ticks: cardinal; -begin - if (Ini.Mouse = 2) then - begin // draw software cursor - Ticks := SDL_GetTicks; - - if (Cursor_Visible) and (Cursor_LastMove + Cursor_AutoHide_Time <= Ticks) then - begin // start fade out after 5 secs w/o activity - Cursor_Visible := false; - Cursor_LastMove := Ticks; - Cursor_Fade := true; - end; - - // fading - if Cursor_Fade then - begin - if Cursor_Visible then - begin // fade in - if (Cursor_LastMove + Cursor_FadeIn_Time <= Ticks) then - Cursor_Fade := false - else - Alpha := sin((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeIn_Time) * 0.7; - end - else - begin //fade out - if (Cursor_LastMove + Cursor_FadeOut_Time <= Ticks) then - Cursor_Fade := false - else - Alpha := cos((Ticks - Cursor_LastMove) * 0.5 * pi / Cursor_FadeOut_Time) * 0.7; - end; - end; - - // no else if here because we may turn off fade in if block - if not Cursor_Fade then - begin - if Cursor_Visible then - Alpha := 0.7 // alpha when cursor visible and not fading - else - Alpha := 0; // alpha when cursor is hidden - end; - - if (Alpha > 0) and (not Cursor_HiddenByScreen) then - begin - glColor4f(1, 1, 1, Alpha); - glEnable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - glDisable(GL_DEPTH_TEST); - - if (Cursor_Pressed) and (Tex_Cursor_Pressed.TexNum > 0) then - glBindTexture(GL_TEXTURE_2D, Tex_Cursor_Pressed.TexNum) - else - glBindTexture(GL_TEXTURE_2D, Tex_Cursor_Unpressed.TexNum); - - glBegin(GL_QUADS); - glTexCoord2f(0, 0); - glVertex2f(Cursor_X, Cursor_Y); - - glTexCoord2f(0, 1); - glVertex2f(Cursor_X, Cursor_Y + 32); - - glTexCoord2f(1, 1); - glVertex2f(Cursor_X + 32, Cursor_Y + 32); - - glTexCoord2f(1, 0); - glVertex2f(Cursor_X + 32, Cursor_Y); - glEnd; - - glDisable(GL_BLEND); - glDisable(GL_TEXTURE_2D); - end; - end; end; procedure TDisplay.SaveScreenShot; @@ -511,7 +318,7 @@ var Align: integer; RowSize: integer; begin -// Exit if Screenshot-path does not exist or read-only + // Exit if Screenshot-path does not exist or read-only if (ScreenshotsPath = '') then Exit; @@ -525,9 +332,9 @@ begin break end; -// we must take the row-alignment (4byte by default) into account + // we must take the row-alignment (4byte by default) into account glGetIntegerv(GL_PACK_ALIGNMENT, @Align); -// calc aligned row-size + // calc aligned row-size RowSize := ((ScreenW*3 + (Align-1)) div Align) * Align; GetMem(ScreenData, RowSize * ScreenH); @@ -540,8 +347,8 @@ begin ScreenData, ScreenW, ScreenH, 24, RowSize, $0000FF, $00FF00, $FF0000, 0); -// Success := WriteJPGImage(FileName, Surface, 95); -// Success := WriteBMPImage(FileName, Surface); + //Success := WriteJPGImage(FileName, Surface, 95); + //Success := WriteBMPImage(FileName, Surface); Success := WritePNGImage(FileName, Surface); if Success then ScreenPopupError.ShowPopup('Screenshot saved: ' + ExtractFileName(FileName)) @@ -553,13 +360,12 @@ begin end; //------------ -// DrawDebugInformation - procedure draw fps and some other informations on screen +// DrawDebugInformation - Procedure draw FPS and some other Informations on Screen //------------ procedure TDisplay.DrawDebugInformation; -var - Ticks: cardinal; +var Ticks: Cardinal; begin -// Some White Background for information + //Some White Background for information glEnable(GL_BLEND); glDisable(GL_TEXTURE_2D); glColor4f(1, 1, 1, 0.5); @@ -571,13 +377,13 @@ begin glEnd; glDisable(GL_BLEND); -// set font specs + //Set Font Specs SetFontStyle(0); SetFontSize(21); - SetFontItalic(false); + SetFontItalic(False); glColor4f(0, 0, 0, 1); -// calculate fps + //Calculate FPS Ticks := SDL_GetTicks(); if (Ticks >= NextFPSSwap) then begin @@ -588,17 +394,17 @@ begin Inc(FPSCounter); -// draw text + //Draw Text -// fps + //FPS SetFontPos(695, 0); glPrint ('FPS: ' + InttoStr(LastFPS)); -// rspeed + //RSpeed SetFontPos(695, 13); glPrint ('RSpeed: ' + InttoStr(Round(1000 * TimeMid))); -// lasterror + //LastError SetFontPos(695, 26); glColor4f(1, 0, 0, 1); glPrint (OSD_LastError); diff --git a/unicode/src/menu/UMenu.pas b/unicode/src/menu/UMenu.pas index 444bac62..6d9fba96 100644 --- a/unicode/src/menu/UMenu.pas +++ b/unicode/src/menu/UMenu.pas @@ -34,20 +34,19 @@ interface {$I switches.inc} uses - SysUtils, - Math, gl, - SDL, - UMenuBackground, - UMenuButton, - UMenuButtonCollection, - UMenuInteract, - UMenuSelectSlide, + SysUtils, + UTexture, UMenuStatic, UMenuText, - UMusic, - UTexture, - UThemes; + UMenuButton, + UMenuSelectSlide, + UMenuInteract, + UMenuBackground, + UThemes, + UMenuButtonCollection, + Math, + UMusic; type { Int16 = SmallInt;} @@ -55,15 +54,15 @@ type PMenu = ^TMenu; TMenu = class protected - Background: TMenuBackground; - - Interactions: array of TInteract; - SelInteraction: integer; + Background: TMenuBackground; - ButtonPos: integer; - Button: array of TButton; + Interactions: array of TInteract; + SelInteraction: integer; - SelectsS: array of TSelectSlide; + ButtonPos: integer; + Button: array of TButton; + + SelectsS: array of TSelectSlide; ButtonCollection: array of TButtonCollection; public Text: array of TText; @@ -73,7 +72,6 @@ type Fade: integer; // fade type ShowFinish: boolean; // true if there is no fade - RightMbESC: boolean; // true to simulate ESC keypress when RMB is pressed destructor Destroy; override; constructor Create; overload; virtual; @@ -82,10 +80,10 @@ type // interaction procedure AddInteraction(Typ, Num: integer); - procedure SetInteraction(Num: integer); virtual; + procedure SetInteraction(Num: integer); property Interaction: integer read SelInteraction write SetInteraction; - // procedure load bg, texts, statics and button collections from themebasic + //Procedure Load BG, Texts, Statics and Button Collections from ThemeBasic procedure LoadFromTheme(const ThemeBasic: TThemeBasic); procedure PrepareButtonCollections(const Collections: AThemeButtonCollection); @@ -111,7 +109,7 @@ type function AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; overload; // button - procedure SetButtonLength(Length: cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button + Procedure SetButtonLength(Length: cardinal); //Function that Set Length of Button Array in one Step instead of register new Memory for every Button function AddButton(ThemeButton: TThemeButton): integer; overload; function AddButton(X, Y, W, H: real; const Name: string): integer; overload; function AddButton(X, Y, W, H: real; const Name: string; Typ: TTextureType; Reflection: boolean): integer; overload; @@ -145,10 +143,9 @@ type function DrawFG: boolean; virtual; function Draw: boolean; virtual; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean; virtual; - function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; virtual; - function InRegion(X1, Y1, W, H, X, Y: real): boolean; - function InteractAt(X, Y: real): integer; - function CollectionAt(X, Y: real): integer; + // FIXME: ParseMouse is not implemented in any subclass and not even used anywhere in the code + // -> do this before activation of this method + //function ParseMouse(Typ: integer; X: integer; Y: integer): boolean; virtual; abstract; procedure onShow; virtual; procedure onShowFinish; virtual; procedure onHide; virtual; @@ -168,16 +165,13 @@ type end; const - MENU_MDOWN = 8; - MENU_MUP = 0; - - pmMove = 1; - pmClick = 2; + pmMove = 1; + pmClick = 2; pmUnClick = 3; - iButton = 0; // interaction type - iText = 2; - iSelectS = 3; + iButton = 0; // interaction type + iText = 2; + iSelectS = 3; iBCollectionChild = 5; // fBlack = 0; // fade type @@ -185,22 +179,21 @@ const implementation -uses - UCommon, - UCovers, - UDisplay, - UDrawTexture, - UGraphic, - ULog, - UMain, - USkins, - UTime, - //Background types - UMenuBackgroundNone, - UMenuBackgroundColor, - UMenuBackgroundTexture, - UMenuBackgroundVideo, - UMenuBackgroundFade; +uses UCommon, + ULog, + UMain, + UDrawTexture, + UGraphic, + UDisplay, + UCovers, + UTime, + USkins, + //Background types + UMenuBackgroundNone, + UMenuBackgroundColor, + UMenuBackgroundTexture, + UMenuBackgroundVideo, + UMenuBackgroundFade; destructor TMenu.Destroy; begin @@ -225,8 +218,6 @@ begin ButtonPos := -1; Background := nil; - - RightMbESC := true; end; { constructor TMenu.Create(Back: string); @@ -258,7 +249,7 @@ begin BackH := H; end; } -function RGBFloatToInt(R, G, B: double): cardinal; +function RGBFloatToInt(R, G, B: Double): cardinal; begin Result := (Trunc(255 * R) shl 16) or (Trunc(255 * G) shl 8) or @@ -297,8 +288,8 @@ begin begin Button[OldNum].Selected := false; - // deselect collection if next button is not from collection - if (NewTyp <> iButton) or (Button[NewNum].Parent <> Button[OldNum].Parent) then + //Deselect Collection if Next Button is Not from Collection + if (NewTyp <> iButton) Or (Button[NewNum].Parent <> Button[OldNum].Parent) then ButtonCollection[Button[OldNum].Parent-1].Selected := false; end; end; @@ -346,9 +337,8 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); var FileExt: string; - function IsInArray(const Piece: string; const A: array of string): boolean; - var - I: integer; + Function IsInArray(const Piece: string; const A: array of string): boolean; + var I: integer; begin Result := false; @@ -360,7 +350,7 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground); end; end; - function TryBGCreate(Typ: cMenuBackground): boolean; + Function TryBGCreate(Typ: cMenuBackground): boolean; begin Result := true; @@ -382,7 +372,7 @@ begin Background := nil; end; - case ThemedSettings.BGType of + Case ThemedSettings.BGType of bgtAuto: begin //Automaticly choose one out of BGT_Texture, BGT_Video or BGT_Color if (Length(ThemedSettings.Tex) > 0) then @@ -499,7 +489,7 @@ end; //---------------------- procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; const Num: byte); var - BT, BTLen: integer; + BT, BTLen: integer; TempCol, TempDCol: cardinal; begin @@ -602,25 +592,17 @@ begin Result := AddStatic(X, Y, W, H, Name, TEXTURE_TYPE_PLAIN); end; -function TMenu.AddStatic(X, Y, W, H: real; - ColR, ColG, ColB: real; - const Name: string; - Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer; begin Result := AddStatic(X, Y, W, H, ColR, ColG, ColB, Name, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; - ColR, ColG, ColB: real; - const Name: string; - Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType): integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, Name, Typ, $FFFFFF); end; -function TMenu.AddStatic(X, Y, W, H: real; - const Name: string; - Typ: TTextureType): integer; +function TMenu.AddStatic(X, Y, W, H: real; const Name: string; Typ: TTextureType): integer; var StatNum: integer; begin @@ -638,32 +620,17 @@ begin Result := StatNum; end; -function TMenu.AddStatic(X, Y, W, H: real; - ColR, ColG, ColB: real; - const Name: string; - Typ: TTextureType; - Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; begin Result := AddStatic(X, Y, W, H, 0, ColR, ColG, ColB, Name, Typ, Color); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; - ColR, ColG, ColB: real; - const Name: string; - Typ: TTextureType; - Color: integer): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; const Name: string; Typ: TTextureType; Color: integer): integer; begin Result := AddStatic(X, Y, W, H, Z, ColR, ColG, ColB, 0, 0, 1, 1, Name, Typ, Color, false, 0); end; -function TMenu.AddStatic(X, Y, W, H, Z: real; - ColR, ColG, ColB: real; - TexX1, TexY1, TexX2, TexY2: real; - const Name: string; - Typ: TTextureType; - Color: integer; - Reflection: boolean; - ReflectionSpacing: real): integer; +function TMenu.AddStatic(X, Y, W, H, Z: real; ColR, ColG, ColB: real; TexX1, TexY1, TexX2, TexY2: real; const Name: string; Typ: TTextureType; Color: integer; Reflection: boolean; ReflectionSpacing: real): integer; var StatNum: integer; begin @@ -681,22 +648,12 @@ begin begin Static[StatNum] := TStatic.Create(Texture.GetTexture(Name, Typ, Color)); // new skin end; - + // configures static Static[StatNum].Texture.X := X; Static[StatNum].Texture.Y := Y; - - //Set height and width via sprite size if omitted - if(H = 0) then - Static[StatNum].Texture.H := Static[StatNum].Texture.H - else - Static[StatNum].Texture.H := H; - - if(W = 0) then - Static[StatNum].Texture.W := Static[StatNum].Texture.W - else - Static[StatNum].Texture.W := W; - + Static[StatNum].Texture.W := W; + Static[StatNum].Texture.H := H; Static[StatNum].Texture.Z := Z; if (Typ <> TEXTURE_TYPE_COLORIZED) then begin @@ -735,22 +692,12 @@ begin Result := TextNum; end; -function TMenu.AddText(X, Y: real; - Style: integer; - Size, ColR, ColG, ColB: real - ; const Text: UTF8String): integer; +function TMenu.AddText(X, Y: real; Style: integer; Size, ColR, ColG, ColB: real; const Text: UTF8String): integer; begin Result := AddText(X, Y, 0, Style, Size, ColR, ColG, ColB, 0, Text, false, 0, 0); end; -function TMenu.AddText(X, Y, W: real; - Style: integer; - Size, ColR, ColG, ColB: real; - Align: integer; - const Text_: UTF8String; - Reflection_: boolean; - ReflectionSpacing_: real; - Z : real): integer; +function TMenu.AddText(X, Y, W: real; Style: integer; Size, ColR, ColG, ColB: real; Align: integer; const Text_: UTF8String; Reflection_: boolean; ReflectionSpacing_: real; Z : real): integer; var TextNum: integer; begin @@ -762,9 +709,9 @@ begin end; //Function that Set Length of Button boolean in one Step instead of register new Memory for every Button -procedure TMenu.SetButtonLength(Length: cardinal); +Procedure TMenu.SetButtonLength(Length: cardinal); begin - if (ButtonPos = -1) and (Length > 0) then + if (ButtonPos = -1) AND (Length > 0) then begin //Set Length of Button SetLength(Button, Length); @@ -820,10 +767,10 @@ begin ThemeButton.Text[BT].Text); end; - // bautton collection mod + //BAutton Collection Mod if (ThemeButton.Parent <> 0) then begin - // if collection exists then change interaction to child button + //If Collection Exists then Change Interaction to Child Button if (@ButtonCollection[ThemeButton.Parent-1] <> nil) then begin Interactions[High(Interactions)].Typ := iBCollectionChild; @@ -852,10 +799,8 @@ begin end; function TMenu.AddButton(X, Y, W, H, ColR, ColG, ColB, Int, DColR, DColG, DColB, DInt: real; - const Name: string; - Typ: TTextureType; - Reflection: boolean; - ReflectionSpacing, DeSelectReflectionSpacing: real): integer; + const Name: string; Typ: TTextureType; + Reflection: boolean; ReflectionSpacing, DeSelectReflectionSpacing: real): integer; begin // adds button //SetLength is used once to reduce Memory usement @@ -908,7 +853,7 @@ begin Button[Result].Reflectionspacing := ReflectionSpacing; Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing; - // button collection mod + //Button Collection Mod Button[Result].Parent := 0; // adds interaction @@ -921,10 +866,11 @@ begin Setlength(Button, 0); end; -// method to draw our tmenu and all his child buttons +// Method to draw our TMenu and all his child buttons function TMenu.DrawBG: boolean; begin Background.Draw; + Result := true; end; @@ -972,9 +918,9 @@ end; } { -function TMenu.AddWidget(X, Y: UInt16; WidgetSrc: PSDL_Surface): Int16; +function TMenu.AddWidget(X, Y : UInt16; WidgetSrc : PSDL_Surface): Int16; var - WidgetNum: Int16; + WidgetNum : Int16; begin if (Assigned(WidgetSrc)) then begin @@ -998,9 +944,9 @@ end; } { -procedure TMenu.ClearWidgets(MinNumber: Int16); +procedure TMenu.ClearWidgets(MinNumber : Int16); var - J: Int16; + J : Int16; begin for J := MinNumber to (Length(WidgetsSrc) - 1) do begin @@ -1043,10 +989,9 @@ begin Int := Int - ceil(Length(Interactions) / 2); //Set Interaction - if ((Int < 0) or (Int > Length(Interactions) - 1)) then - Int := Interaction // invalid button, keep current one - else - Interaction := Int; // select row above + if ((Int < 0) or (Int > Length(Interactions) - 1)) + then Int := Interaction //nonvalid button, keep current one + else Interaction := Int; //select row above end; procedure TMenu.InteractNextRow; @@ -1058,10 +1003,9 @@ begin Int := Int + ceil(Length(Interactions) / 2); //Set Interaction - if ((Int < 0) or (Int > Length(Interactions) - 1)) then - Int := Interaction // invalid button, keep current one - else - Interaction := Int; // select row above + if ((Int < 0) or (Int > Length(Interactions) - 1)) + then Int := Interaction //nonvalid button, keep current one + else Interaction := Int; //select row above end; procedure TMenu.InteractNext; @@ -1075,8 +1019,7 @@ begin Int := (Int + 1) mod Length(Interactions); //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then - Break; + if (Int = Interaction) then Break; until IsSelectable(Int); @@ -1093,12 +1036,10 @@ begin // change interaction as long as it's needed repeat Int := Int - 1; - if Int = -1 then - Int := High(Interactions); + if Int = -1 then Int := High(Interactions); //If no Interaction is Selectable Simply Select Next - if (Int = Interaction) then - Break; + if (Int = Interaction) then Break; until IsSelectable(Int); //Set Interaction @@ -1123,8 +1064,7 @@ begin while (Again = true) do begin Num := SelInteraction - CustomSwitch; - if Num = -1 then - Num := High(Interactions); + if Num = -1 then Num := High(Interactions); Interaction := Num; Again := false; // reset, default to accept changing interaction @@ -1268,9 +1208,6 @@ begin SelectsS[High(SelectsS)].Texture.Z := ThemeSelectS.Z; SelectsS[High(SelectsS)].TextureSBG.Z := ThemeSelectS.Z; - SelectsS[High(SelectsS)].showArrows := ThemeSelectS.showArrows; - SelectsS[High(SelectsS)].oneItemOnly := ThemeSelectS.oneItemOnly; - //Generate Lines SelectsS[High(SelectsS)].GenLines; @@ -1313,21 +1250,9 @@ begin SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp, RGBFloatToInt(SBGColR, SBGColG, SBGColB)) else SelectsS[S].TextureSBG := Texture.GetTexture(SBGName, SBGTyp); - - SelectsS[High(SelectsS)].Tex_SelectS_ArrowL := Tex_SelectS_ArrowL; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.X := X + W + SkipX; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.Y := Y; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.W := Tex_SelectS_ArrowL.W; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowL.H := Tex_SelectS_ArrowL.H; - - SelectsS[High(SelectsS)].Tex_SelectS_ArrowR := Tex_SelectS_ArrowR; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.X := X + W + SkipX + SBGW - Tex_SelectS_ArrowR.W; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.Y := Y; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.W := Tex_SelectS_ArrowR.W; - SelectsS[High(SelectsS)].Tex_SelectS_ArrowR.H := Tex_SelectS_ArrowR.H; - SelectsS[S].TextureSBG.X := X + W + SkipX; SelectsS[S].TextureSBG.Y := Y; + //SelectsS[S].TextureSBG.W := 450; SelectsS[S].SBGW := SBGW; SelectsS[S].TextureSBG.H := H; SelectsS[S].SBGColR := SBGColR; @@ -1425,12 +1350,10 @@ begin SetLength(SelectsS[SelectNo].TextOptT, SO + 1); SelectsS[SelectNo].TextOptT[SO] := AddText; -{ - SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh - if SO = Selects[S].PData^ then - Selects[S].SelectedOption := SO; -} + //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh + + //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO; end; procedure TMenu.UpdateSelectSlideOptions(ThemeSelectSlide: TThemeSelectSlide; SelectNum: integer; const Values: array of string; var Data: integer); @@ -1530,12 +1453,12 @@ begin end; end; end; - // interact prev if there is nothing to change + //interact Prev if there is Nothing to Change else begin InteractPrev; - // if buttoncollection with more than 1 entry then select last entry - if (Button[Interactions[Interaction].Num].Parent <> 0) and (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then + //If ButtonCollection with more than 1 Entry then Select Last Entry + if (Button[Interactions[Interaction].Num].Parent <> 0) AND (ButtonCollection[Button[Interactions[Interaction].Num].Parent-1].CountChilds > 1) then begin //Select Last Child for Num := High(Button) downto 1 do @@ -1604,120 +1527,10 @@ begin Result := true; end; -function TMenu.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; -var - nBut: integer; -begin - //default mouse parsing: clicking generates return keypress, - // mousewheel selects in select slide - //override ParseMouse to customize - Result := true; - - if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then - begin - //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, 0, true); - end; - - nBut := InteractAt(X, Y); - if nBut >= 0 then - begin - //select on mouse-over - if nBut <> Interaction then - SetInteraction(nBut); - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - begin - //click button - Result:=ParseInput(SDLK_RETURN, 0, true); - end; - if (Interactions[nBut].Typ = iSelectS) then - begin - //forward/backward in select slide with mousewheel - if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then - begin - ParseInput(SDLK_RIGHT, 0, true); - end; - if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then - begin - ParseInput(SDLK_LEFT, 0, true); - end; - end; - end - else - begin - nBut := CollectionAt(X, Y); - if nBut >= 0 then - begin - // if over button collection, select first child but don't allow click - nBut := ButtonCollection[nBut].FirstChild - 1; - if nBut <> Interaction then - SetInteraction(nBut); - end; - end; -end; - -function TMenu.InRegion(X1, Y1, W, H, X, Y: real): boolean; -begin - Result := false; - X1 := X1 * Screen.w / 800; - W := W * Screen.w / 800; - Y1 := Y1 * Screen.h / 600; - H := H * Screen.h / 600; - if (X >= X1) and (X <= X1 + W) and (Y >= Y1) and (Y <= Y1 + H) then - Result := true; -end; - -//takes x,y coordinates and returns the interaction number -//of the control at this position -function TMenu.InteractAt(X, Y: real): integer; -var - i, nBut: integer; -begin - Result := -1; - for i := Low(Interactions) to High(Interactions) do - begin - case Interactions[i].Typ of - iButton: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) and - Button[Interactions[i].Num].Visible then - begin - Result:=i; - exit; - end; - iBCollectionChild: if InRegion(Button[Interactions[i].Num].X, Button[Interactions[i].Num].Y, Button[Interactions[i].Num].W, Button[Interactions[i].Num].H, X, Y) then - begin - Result:=i; - exit; - end; - iSelectS: if InRegion(SelectSs[Interactions[i].Num].X, SelectSs[Interactions[i].Num].Y, SelectSs[Interactions[i].Num].W, SelectSs[Interactions[i].Num].H, X, Y) or - InRegion(SelectSs[Interactions[i].Num].TextureSBG.X, SelectSs[Interactions[i].Num].TextureSBG.Y, SelectSs[Interactions[i].Num].TextureSBG.W, SelectSs[Interactions[i].Num].TextureSBG.H, X, Y) then - begin - Result:=i; - exit; - end; - end; - end; -end; - -//takes x,y coordinates and returns the button collection id -function TMenu.CollectionAt(X, Y: real): integer; -var - i, nBut: integer; -begin - Result := -1; - for i:= Low(ButtonCollection) to High(ButtonCollection) do - begin - if InRegion(ButtonCollection[i].X, ButtonCollection[i].Y, ButtonCollection[i].W, ButtonCollection[i].H, X, Y) and - ButtonCollection[i].Visible then - begin - Result:=i; - exit; - end; - end; -end; - procedure TMenu.SetAnimationProgress(Progress: real); begin // nothing end; end. + diff --git a/unicode/src/menu/UMenuBackgroundFade.pas b/unicode/src/menu/UMenuBackgroundFade.pas index b61a4542..dc37da45 100644 --- a/unicode/src/menu/UMenuBackgroundFade.pas +++ b/unicode/src/menu/UMenuBackgroundFade.pas @@ -62,17 +62,15 @@ const FADEINTIME = 1500; //Time the bg fades in
implementation
-uses
- sdl,
- gl,
- glext,
- USkins,
- UCommon,
- UGraphic;
+uses sdl,
+ gl,
+ glext,
+ USkins,
+ UCommon,
+ UGraphic;
constructor TMenuBackgroundFade.Create(const ThemedSettings: TThemeBackground);
-var
- texFilename: string;
+var texFilename: string;
begin
inherited;
FadeTime := 0;
@@ -124,7 +122,7 @@ begin if (UseTexture) then
begin //Draw Texture to Screen
- if (ScreenAct = 1) then //Clear just once when in dual screen mode
+ If (ScreenAct = 1) then //Clear just once when in dual screen mode
glClear(GL_DEPTH_BUFFER_BIT);
glEnable(GL_TEXTURE_2D);
@@ -153,7 +151,7 @@ begin end
else
begin //Clear Screen w/ progress Alpha + Color
- if (ScreenAct = 1) then //Clear just once when in dual screen mode
+ If (ScreenAct = 1) then //Clear just once when in dual screen mode
glClear(GL_DEPTH_BUFFER_BIT);
glDisable(GL_TEXTURE_2D);
diff --git a/unicode/src/menu/UMenuButton.pas b/unicode/src/menu/UMenuButton.pas index 923f0b14..c6ff8ab7 100644 --- a/unicode/src/menu/UMenuButton.pas +++ b/unicode/src/menu/UMenuButton.pas @@ -55,6 +55,7 @@ type PosX, PosY: real; + constructor Create(); overload; public Text: array of TText; @@ -112,7 +113,6 @@ type procedure Draw; virtual; - constructor Create(); overload; constructor Create(Textura: TTexture); overload; constructor Create(Textura, DSTexture: TTexture); overload; destructor Destroy; override; @@ -252,6 +252,42 @@ begin end; end; +constructor TButton.Create(); +begin + inherited Create; + // We initialize all to 0, nil or false + Visible := true; + SelectBool := false; + DeselectType := 0; + Selectable := true; + Reflection := false; + Colorized := false; + + SelectColR := 1; + SelectColG := 1; + SelectColB := 1; + SelectInt := 1; + SelectTInt := 1; + + DeselectColR := 1; + DeselectColG := 1; + DeselectColB := 1; + DeselectInt := 0.5; + DeselectTInt := 1; + + Fade := false; + FadeTex.TexNum := 0; + FadeProgress := 0; + FadeText := false; + SelectW := DeSelectW; + SelectH := DeSelectH; + + PosX := 0; + PosY := 0; + + Parent := 0; +end; + // ***** Public methods ****** // procedure TButton.Draw; @@ -535,42 +571,6 @@ begin inherited; end; -constructor TButton.Create(); -begin - inherited Create; - // We initialize all to 0, nil or false - Visible := true; - SelectBool := false; - DeselectType := 0; - Selectable := true; - Reflection := false; - Colorized := false; - - SelectColR := 1; - SelectColG := 1; - SelectColB := 1; - SelectInt := 1; - SelectTInt := 1; - - DeselectColR := 1; - DeselectColG := 1; - DeselectColB := 1; - DeselectInt := 0.5; - DeselectTInt := 1; - - Fade := false; - FadeTex.TexNum := 0; - FadeProgress := 0; - FadeText := false; - SelectW := DeSelectW; - SelectH := DeSelectH; - - PosX := 0; - PosY := 0; - - Parent := 0; -end; - constructor TButton.Create(Textura: TTexture); begin Create(); diff --git a/unicode/src/menu/UMenuButtonCollection.pas b/unicode/src/menu/UMenuButtonCollection.pas index 8b7a1c3f..c6c6dd81 100644 --- a/unicode/src/menu/UMenuButtonCollection.pas +++ b/unicode/src/menu/UMenuButtonCollection.pas @@ -41,61 +41,61 @@ type //TButtonCollection //No Extra Attributes or Functions ATM //---------------- - AButton = array of TButton; + AButton = Array of TButton; PAButton = ^AButton; TButtonCollection = class(TButton) //num of the First Button, that can be Selected - FirstChild: byte; - CountChilds: byte; + FirstChild: Byte; + CountChilds: Byte; ScreenButton: PAButton; - procedure SetSelect(Value : boolean); override; + procedure SetSelect(Value : Boolean); override; procedure Draw; override; end; implementation -procedure TButtonCollection.SetSelect(Value : boolean); -var - Index: integer; +procedure TButtonCollection.SetSelect(Value : Boolean); +var I: Integer; begin inherited; //Set Visible for Every Button that is a Child of this ButtonCollection - if (not Fade) then - for Index := 0 to High(ScreenButton^) do - if (ScreenButton^[Index].Parent = Parent) then - ScreenButton^[Index].Visible := Value; + if (Not Fade) then + For I := 0 to High(ScreenButton^) do + if (ScreenButton^[I].Parent = Parent) then + ScreenButton^[I].Visible := Value; end; procedure TButtonCollection.Draw; -var - I, J: integer; +var I, J: Integer; begin inherited; //If fading is activated, Fade Child Buttons if (Fade) then begin - for I := 0 to High(ScreenButton^) do + For I := 0 to High(ScreenButton^) do if (ScreenButton^[I].Parent = Parent) then begin if (FadeProgress < 0.5) then begin ScreenButton^[I].Visible := SelectBool; - for J := 0 to High(ScreenButton^[I].Text) do + For J := 0 to High(ScreenButton^[I].Text) do ScreenButton^[I].Text[J].Visible := SelectBool; end else begin ScreenButton^[I].Texture.Alpha := (FadeProgress-0.666)*3; - for J := 0 to High(ScreenButton^[I].Text) do + For J := 0 to High(ScreenButton^[I].Text) do ScreenButton^[I].Text[J].Alpha := (FadeProgress-0.666)*3; end; end; end; end; + + end. diff --git a/unicode/src/menu/UMenuEqualizer.pas b/unicode/src/menu/UMenuEqualizer.pas index 8f57e44a..6d77721c 100644 --- a/unicode/src/menu/UMenuEqualizer.pas +++ b/unicode/src/menu/UMenuEqualizer.pas @@ -45,71 +45,69 @@ type Tms_Equalizer = class(TObject) private FFTData: TFFTData; // moved here to avoid stack overflows - BandData: array of byte; - RefreshTime: cardinal; + BandData: array of Byte; + RefreshTime: Cardinal; Source: IAudioPlayback; - procedure Analyse; + Procedure Analyse; public - X: integer; - Y: integer; - Z: real; + X: Integer; + Y: Integer; + Z: Real; - W: integer; - H: integer; - Space: integer; + W: Integer; + H: Integer; + Space: Integer; - Visible: boolean; - Alpha: real; - Color: TRGB; + Visible: Boolean; + Alpha: real; + Color: TRGB; - Direction: boolean; - BandLength: integer; + Direction: Boolean; - Reflection: boolean; - Reflectionspacing: real; + BandLength: Integer; + + Reflection: boolean; + Reflectionspacing: Real; constructor Create(Source: IAudioPlayback; mySkin: TThemeEqualizer); procedure Draw; - procedure SetBands(Value: byte); - function GetBands: byte; - property Bands: byte read GetBands write SetBands; + + Procedure SetBands(Value: Byte); + Function GetBands: Byte; + Property Bands: Byte read GetBands write SetBands; procedure SetSource(newSource: IAudioPlayback); end; implementation -uses - math, - SDL, - gl, - glext; +uses math, SDL, gl, glext; + constructor Tms_Equalizer.Create(Source: IAudioPlayback; mySkin: TThemeEqualizer); -var - I: integer; +var I: Integer; begin - if (Source <> nil) then + If (Source <> nil) then begin - X := mySkin.X; - Y := mySkin.Y; - W := mySkin.W; - H := mySkin.H; - Z := mySkin.Z; + X := mySkin.X; + Y := mySkin.Y; + W := mySkin.W; + H := mySkin.H; + Z := mySkin.Z; - Space := mySkin.Space; + Space := mySkin.Space; - Visible := mySkin.Visible; - Alpha := mySkin.Alpha; - Color.R := mySkin.ColR; - Color.G := mySkin.ColG; - Color.B := mySkin.ColB; + Visible := mySkin.Visible; + Alpha := mySkin.Alpha; + Color.R := mySkin.ColR; + Color.G := mySkin.ColG; + Color.B := mySkin.ColB; - Direction := mySkin.Direction; - Bands := mySkin.Bands; - BandLength := mySkin.Length; + Direction := mySkin.Direction; + Bands := mySkin.Bands; + BandLength := mySkin.Length; Reflection := mySkin.Reflection; Reflectionspacing := mySkin.Reflectionspacing; @@ -118,31 +116,31 @@ begin //Check if Visible - if (Bands <= 0) or - (BandLength <= 0) or - (W <= 0) or - (H <= 0) or + If (Bands <= 0) OR + (BandLength <= 0) OR + (W <= 0) OR + (H <= 0) OR (Alpha <= 0) then - Visible := false; + Visible := False; //ClearArray - for I := low(BandData) to high(BandData) do + For I := low(BandData) to high(BandData) do BandData[I] := 3; end else - Visible := false; + Visible := False; end; //-------- // evaluate FFT-Data //-------- -procedure Tms_Equalizer.Analyse; -var - I: integer; - ChansPerBand: byte; // channels per band - MaxChannel: integer; - Pos: real; - CurBand: integer; +Procedure Tms_Equalizer.Analyse; + var + I: Integer; + ChansPerBand: byte; // channels per band + MaxChannel: Integer; + Pos: Real; + CurBand: Integer; begin Source.GetFFTData(FFTData); @@ -190,26 +188,25 @@ end; // Draw SpectrumAnalyser, Call Analyse //-------- procedure Tms_Equalizer.Draw; -var - CurTime: cardinal; - PosX, PosY: real; - I, J: integer; - Diff: real; + var + CurTime: Cardinal; + PosX, PosY: Real; + I, J: Integer; + Diff: Real; - function GetAlpha(Diff: single): single; + Function GetAlpha(Diff: Single): Single; begin - if Direction then - Result := (Alpha * 0.6) * (0.5 - Diff/(BandLength * (H + Space))) + If Direction then + Result := (Alpha * 0.6) *(0.5 - Diff/(BandLength * (H + Space))) else - Result := (Alpha * 0.6) * (0.5 - Diff/(Bands * (H + Space))); + Result := (Alpha * 0.6) *(0.5 - Diff/(Bands * (H + Space))); end; - begin - if (Visible) and not (AudioPlayback.Finished) then + If (Visible) AND not (AudioPlayback.Finished) then begin //Call Analyse if necessary CurTime := SDL_GetTicks(); - if (CurTime > RefreshTime) then + If (CurTime > RefreshTime) then begin Analyse; @@ -247,12 +244,12 @@ begin glVertex3f(PosX+W, PosY, Z); glEnd; - if (Reflection) and (J <= BandLength div 2) then + If (Reflection) AND (J <= BandLength div 2) then begin Diff := (Y-PosY) + H; //Draw Reflection - if Direction then + If Direction then begin glBegin(GL_QUADS); glColorRGB(Color, GetAlpha(Diff)); @@ -301,20 +298,22 @@ begin end; end; -procedure Tms_Equalizer.SetBands(Value: byte); +Procedure Tms_Equalizer.SetBands(Value: Byte); begin SetLength(BandData, Value); end; -function Tms_Equalizer.GetBands: byte; +Function Tms_Equalizer.GetBands: Byte; begin Result := Length(BandData); end; -procedure Tms_Equalizer.SetSource(newSource: IAudioPlayback); +Procedure Tms_Equalizer.SetSource(newSource: IAudioPlayback); begin - if (newSource <> nil) then + If (newSource <> nil) then Source := newSource; end; + + end.
\ No newline at end of file diff --git a/unicode/src/menu/UMenuInteract.pas b/unicode/src/menu/UMenuInteract.pas index beb6bcef..4c2d4e86 100644 --- a/unicode/src/menu/UMenuInteract.pas +++ b/unicode/src/menu/UMenuInteract.pas @@ -35,8 +35,8 @@ interface type TInteract = record // for moving thru menu - Typ: integer; // 0 - button, 1 - select, 2 - Text, 3 - Select SLide, 5 - ButtonCollection Child - Num: integer; // number of this item in proper list like buttons, selects + Typ: integer; // 0 - button, 1 - select, 2 - Text, 3 - Select SLide, 5 - ButtonCollection Child + Num: integer; // number of this item in proper list like buttons, selects end; implementation diff --git a/unicode/src/menu/UMenuSelectSlide.pas b/unicode/src/menu/UMenuSelectSlide.pas index f9f6bbae..1a0fa725 100644 --- a/unicode/src/menu/UMenuSelectSlide.pas +++ b/unicode/src/menu/UMenuSelectSlide.pas @@ -34,10 +34,10 @@ interface {$I switches.inc} uses - gl, TextGL, - UMenuText, - UTexture; + UTexture, + gl, + UMenuText; type PSelectSlide = ^TSelectSlide; @@ -54,23 +54,17 @@ type TextureSBG: TTexture; // Background Selections Texture // TextureS: array of TTexture; // Selections Texture (not used) - Tex_SelectS_ArrowL: TTexture; // Texture for left arrow - Tex_SelectS_ArrowR: TTexture; // Texture for right arrow +// TextureArrowL: TTexture; // Texture for left arrow (not used yet) +// TextureArrowR: TTexture; // Texture for right arrow (not used yet) SelectOptInt: integer; PData: ^integer; //For automatically Setting LineCount - Lines: byte; - - //Arrows on/off - showArrows: boolean; //default is false - - //whether to show one item or all that fit into the select - oneItemOnly: boolean; //default is false + Lines: Byte; //Visibility - Visible: boolean; + Visible: Boolean; // for selection and deselection // main static @@ -127,7 +121,7 @@ type // procedures procedure SetSelect(Value: boolean); - property Selected: boolean read SelectBool write SetSelect; + property Selected: Boolean read SelectBool write SetSelect; procedure SetSelectOpt(Value: integer); property SelectedOption: integer read SelectOptInt write SetSelectOpt; procedure Draw; @@ -138,12 +132,7 @@ type end; implementation - -uses - math, - SysUtils, - UDrawTexture, - ULog; +uses UDrawTexture, math, ULog, SysUtils; // ------------ Select constructor TSelectSlide.Create; @@ -152,17 +141,24 @@ begin Text := TText.Create; SetLength(TextOpt, 1); TextOpt[0] := TText.Create; - Visible := true; + + //Set Standard Width for Selections Background + SBGW := 450; + + Visible := True; + {SetLength(TextOpt, 3); + TextOpt[0] := TText.Create; + TextOpt[1] := TText.Create; + TextOpt[2] := TText.Create;} end; procedure TSelectSlide.SetSelect(Value: boolean); {var - SO: integer; - I: integer;} + SO: integer; + I: integer;} begin SelectBool := Value; - if Value then - begin + if Value then begin Texture.ColR := ColR; Texture.ColG := ColG; Texture.ColB := ColB; @@ -177,9 +173,15 @@ begin TextureSBG.ColG := SBGColG; TextureSBG.ColB := SBGColB; TextureSBG.Int := SBGInt; - end - else - begin + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STColR; + TextOpt[I].ColG := STColG; + TextOpt[I].ColB := STColB; + TextOpt[I].Int := STInt; + end;} + + end else begin Texture.ColR := DColR; Texture.ColG := DColG; Texture.ColB := DColB; @@ -194,215 +196,185 @@ begin TextureSBG.ColG := SBGDColG; TextureSBG.ColB := SBGDColB; TextureSBG.Int := SBGDInt; + +{ for I := 0 to High(TextOpt) do begin + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; + end;} end; end; procedure TSelectSlide.SetSelectOpt(Value: integer); var - SO: integer; - HalfL: integer; - HalfR: integer; + SO: integer; + HalfL: integer; + HalfR: integer; - procedure DoSelection(Sel: cardinal); - var - I: integer; +procedure DoSelection(Sel: Cardinal); + var I: Integer; begin - for I := Low(TextOpt) to High(TextOpt) do + for I := low(TextOpt) to high(TextOpt) do begin TextOpt[I].ColR := STDColR; TextOpt[I].ColG := STDColG; TextOpt[I].ColB := STDColB; TextOpt[I].Int := STDInt; end; - - if (integer(Sel) <= High(TextOpt)) then + if (integer(Sel) <= high(TextOpt)) then begin TextOpt[Sel].ColR := STColR; TextOpt[Sel].ColG := STColG; TextOpt[Sel].ColB := STColB; TextOpt[Sel].Int := STInt; - end; end; - + end; begin SelectOptInt := Value; PData^ := Value; +// SetSelect(true); // reset all colors - if (Length(TextOpt) > 0) and (Length(TextOptT) > 0) then + if (Length(TextOpt)>0) AND (Length(TextOptT)>0) then begin - //First option selected if (Value <= 0) then - begin + begin //First Option Selected Value := 0; - Tex_SelectS_ArrowL.alpha := 0; - Tex_SelectS_ArrowR.alpha := 1; - - for SO := Low(TextOpt) to High(TextOpt) do + for SO := low (TextOpt) to high(TextOpt) do begin - TextOpt[SO].Text := TextOptT[SO]; + TextOpt[SO].Text := TextOptT[SO]; end; DoSelection(0); end + else if (Value >= high(TextOptT)) then + begin //Last Option Selected + Value := high(TextOptT); - //Last option selected - else if (Value >= High(TextOptT)) then - begin - Value := High(TextOptT); - - Tex_SelectS_ArrowL.alpha := 1; - Tex_SelectS_ArrowR.alpha := 0; - - for SO := High(TextOpt) downto Low(TextOpt) do + for SO := high(TextOpt) downto low (TextOpt) do begin - TextOpt[SO].Text := TextOptT[High(TextOptT) - (Lines - SO - 1)]; + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; end; - DoSelection(Lines - 1); + DoSelection(Lines-1); end - - //in between first and last else begin - Tex_SelectS_ArrowL.alpha := 1; - Tex_SelectS_ArrowR.alpha := 1; - - HalfL := Ceil((Lines - 1) / 2); - HalfR := Lines - 1 - HalfL; - - //Selected option is near to the left side - if (Value <= HalfL) then + HalfL := Ceil((Lines-1)/2); + HalfR := Lines-1-HalfL; + + if (Value <= HalfL) then + begin //Selected Option is near to the left side + {HalfL := Value; + HalfR := Lines-1-HalfL;} + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do begin - //Change texts - for SO := Low(TextOpt) to High(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[SO]; - end; - - DoSelection(Value); - end + TextOpt[SO].Text := TextOptT[SO]; + end; - //Selected option is near to the right side - else if (Value > High(TextOptT) - HalfR) then + DoSelection(Value); + end + else if (Value > High(TextOptT)-HalfR) then + begin //Selected is too near to the right border + HalfR := high(TextOptT) - Value; + HalfL := Lines-1-HalfR; + //Change Texts + for SO := high(TextOpt) downto low (TextOpt) do begin - HalfR := High(TextOptT) - Value; - HalfL := Lines - 1 - HalfR; - //Change texts - for SO := High(TextOpt) downto Low(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[High(TextOptT) - (Lines - SO - 1)]; - end; - - DoSelection (HalfL); - end + TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)]; + end; - else + DoSelection (HalfL); + end + else + begin + //Change Texts + for SO := low (TextOpt) to high(TextOpt) do begin - //Change Texts - for SO := Low(TextOpt) to High(TextOpt) do - begin - TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; - end; - - DoSelection(HalfL); + TextOpt[SO].Text := TextOptT[Value - HalfL + SO]; end; + + DoSelection(HalfL); + end; + end; + end; + end; procedure TSelectSlide.Draw; var - SO: integer; + SO: integer; begin if Visible then begin DrawTexture(Texture); DrawTexture(TextureSBG); - if showArrows then - begin - DrawTexture(Tex_SelectS_ArrowL); - DrawTexture(Tex_SelectS_ArrowR); - end; - Text.Draw; - for SO := Low(TextOpt) to High(TextOpt) do + for SO := low(TextOpt) to high(TextOpt) do TextOpt[SO].Draw; end; end; procedure TSelectSlide.GenLines; var - maxlength: real; - I: integer; +maxlength: Real; +I: Integer; begin SetFontStyle(0{Text.Style}); SetFontSize(Text.Size); maxlength := 0; - for I := Low(TextOptT) to High(TextOptT) do + for I := low(TextOptT) to high (TextOptT) do begin if (glTextWidth(TextOptT[I]) > maxlength) then maxlength := glTextWidth(TextOptT[I]); end; + Lines := floor((TextureSBG.W-40) / (maxlength+7)); + if (Lines > Length(TextOptT)) then + Lines := Length(TextOptT); - if (oneItemOnly = false) then - begin - //show all items - Lines := floor((TextureSBG.W-40) / (maxlength+7)); - if (Lines > Length(TextOptT)) then - Lines := Length(TextOptT); - - if (Lines <= 0) then - Lines := 1; - end - else - begin - //show one item only + if (Lines <= 0) then Lines := 1; - end; //Free old Space used by Texts - for I := Low(TextOpt) to High(TextOpt) do + For I := low(TextOpt) to high(TextOpt) do TextOpt[I].Free; setLength (TextOpt, Lines); - for I := Low(TextOpt) to High(TextOpt) do - begin - TextOpt[I] := TText.Create; - TextOpt[I].Size := Text.Size; - //TextOpt[I].Align := 1; - TextOpt[I].Align := 0; - TextOpt[I].Visible := true; - - TextOpt[I].ColR := STDColR; - TextOpt[I].ColG := STDColG; - TextOpt[I].ColB := STDColB; - TextOpt[I].Int := STDInt; - - //Generate Positions - //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); - if (I <> High(TextOpt)) or (High(TextOpt) = 0) or (Length(TextOptT) = Lines) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I - else - TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; + for I := low(TextOpt) to high(TextOpt) do + begin + TextOpt[I] := TText.Create; + TextOpt[I].Size := Text.Size; + //TextOpt[I].Align := 1; + TextOpt[I].Align := 0; + TextOpt[I].Visible := True; - TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2; + TextOpt[I].ColR := STDColR; + TextOpt[I].ColG := STDColG; + TextOpt[I].ColB := STDColB; + TextOpt[I].Int := STDInt; - //Better Look with 2 Options - if (Lines = 2) and (Length(TextOptT) = 2) then - TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I; + //Generate Positions + //TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * (I + 0.5); + if (I <> High(TextOpt)) OR (High(TextOpt) = 0) OR (Length(TextOptT) = Lines) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W / Lines) * I + else + TextOpt[I].X := TextureSBG.X + TextureSBG.W - maxlength; - if (Lines = 1) then - begin - TextOpt[I].Align := 1; //center text - TextOpt[I].X := TextureSBG.X + (TextureSBG.W / 2); + TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 2; + + //Better Look with 2 Options + if (Lines=2) AND (Length(TextOptT)= 2) then + TextOpt[I].X := TextureSBG.X + 20 + (TextureSBG.W -40 - glTextWidth(TextOptT[1])) * I; end; - end; end; end. diff --git a/unicode/src/menu/UMenuStatic.pas b/unicode/src/menu/UMenuStatic.pas index 72f4eb36..9a10fade 100644 --- a/unicode/src/menu/UMenuStatic.pas +++ b/unicode/src/menu/UMenuStatic.pas @@ -40,20 +40,19 @@ uses type TStatic = class public - Texture: TTexture; // Button Screen position and size - Visible: boolean; + Texture: TTexture; // Button Screen position and size + Visible: boolean; //Reflection Mod - Reflection: boolean; - Reflectionspacing: real; + Reflection: boolean; + Reflectionspacing: Real; procedure Draw; constructor Create(Textura: TTexture); overload; end; implementation -uses - UDrawTexture; +uses UDrawTexture; procedure TStatic.Draw; begin diff --git a/unicode/src/menu/UMenuText.pas b/unicode/src/menu/UMenuText.pas index 88cda855..87f9ce54 100644 --- a/unicode/src/menu/UMenuText.pas +++ b/unicode/src/menu/UMenuText.pas @@ -34,29 +34,29 @@ interface {$I switches.inc} uses + TextGL, + UTexture, + gl, math, SysUtils, - gl, - SDL, - TextGL, - UTexture; + SDL; type TText = class private - SelectBool: boolean; - TextString: UTF8String; - TextTiles: array of UTF8String; + SelectBool: boolean; + TextString: UTF8String; + TextTiles: array of UTF8String; - STicks: cardinal; - SelectBlink: boolean; + STicks: Cardinal; + SelectBlink: boolean; public X: real; Y: real; Z: real; - MoveX: real; // some modifier for x - position that don't affect the real Y - MoveY: real; // some modifier for y - position that don't affect the real Y - W: real; // text wider than W is broken + MoveX: real; //Some Modifier for X - Position that don't affect the real Y + MoveY: real; //Some Modifier for Y - Position that don't affect the real Y + W: real; //text wider than W is broken // H: real; Size: real; ColR: real; @@ -64,13 +64,13 @@ type ColB: real; Alpha: real; Int: real; - Style: integer; - Visible: boolean; - Align: integer; // 0 = left, 1 = center, 2 = right + Style: integer; + Visible: boolean; + Align: integer; // 0 = left, 1 = center, 2 = right - // reflection - Reflection: boolean; - ReflectionSpacing: real; + //Reflection + Reflection: boolean; + ReflectionSpacing: real; procedure SetSelect(Value: boolean); property Selected: boolean read SelectBool write SetSelect; @@ -97,36 +97,35 @@ procedure TText.SetSelect(Value: boolean); begin SelectBool := Value; - // set cursor visible - SelectBlink := true; + //Set Cursor Visible + SelectBlink := True; STicks := SDL_GetTicks() div 550; end; procedure TText.SetText(Value: UTF8String); var - NextPos: cardinal; // next pos of a space etc. - LastPos: cardinal; // last pos " - LastBreak: cardinal; // last break - isBreak: boolean; // true if the break is not caused because the text is out of the area - FirstWord: word; // is first word after break? - Len: word; // length of the tiles array + NextPos: Cardinal; //NextPos of a Space etc. + LastPos: Cardinal; //LastPos " + LastBreak: Cardinal; //Last Break + isBreak: boolean; //True if the Break is not Caused because the Text is out of the area + FirstWord: Word; //Is First Word after Break? + Len: Word; //Length of the Tiles Array function GetNextPos: boolean; var - T1, {T2,} T3: cardinal; + T1, {T2,} T3: Cardinal; begin LastPos := NextPos; - // next space (if width is given) + //Next Space (If Width is given) if (W > 0) then T1 := PosEx(' ', Value, LastPos + 1) - else - T1 := Length(Value); + else T1 := Length(Value); - {// next - + {//Next - T2 := PosEx('-', Value, LastPos + 1);} - // next break + //Next Break T3 := PosEx('\n', Value, LastPos + 1); if T1 = 0 then @@ -136,19 +135,19 @@ var if T3 = 0 then T3 := Length(Value); - // get nearest pos + //Get Nearest Pos NextPos := min(T1, T3{min(T2, T3)}); - if (LastPos = cardinal(Length(Value))) then + if (LastPos = Length(Value)) then NextPos := 0; - isBreak := (NextPos = T3) and (NextPos <> cardinal(Length(Value))); + isBreak := (NextPos = T3) AND (NextPos <> Length(Value)); Result := (NextPos <> 0); end; - procedure AddBreak(const From, bTo: cardinal); + procedure AddBreak(const From, bTo: Cardinal); begin - if (isBreak) or (bTo - From >= 1) then + if (isBreak) OR (bTo - From >= 1) then begin Inc(Len); SetLength (TextTiles, Len); @@ -163,14 +162,14 @@ var end; begin - // set TextString + //Set TExtstring TextString := Value; - // set cursor visible - SelectBlink := true; + //Set Cursor Visible + SelectBlink := True; STicks := SDL_GetTicks() div 550; - // exit if there is no need to create tiles + //Exit if there is no Need to Create Tiles if (W <= 0) and (Pos('\n', Value) = 0) then begin SetLength (TextTiles, 1); @@ -178,12 +177,12 @@ begin Exit; end; - // create tiles - // reset text array + //Create Tiles + //Reset Text Array SetLength (TextTiles, 0); Len := 0; - // reset counter vars + //Reset Counter Vars LastPos := 1; NextPos := 1; LastBreak := 1; @@ -191,57 +190,57 @@ begin if (W > 0) then begin - // set font properties + //Set Font Properties SetFontStyle(Style); SetFontSize(Size); end; - // go through text + //go Through Text while (GetNextPos) do begin - // break in text + //Break in Text if isBreak then begin - // look for break before the break + //Look for Break before the Break if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) AND (NextPos-LastPos > 1) then begin - isBreak := false; - // not the first word after break, so we don't have to break within a word + isBreak := False; + //Not the First word after Break, so we don't have to break within a word if (FirstWord > 1) then begin - // add break before actual position, because there the text fits the area + //Add Break before actual Position, because there the Text fits the Area AddBreak(LastBreak, LastPos); end - else // first word after break break within the word + else //First Word after Break Break within the Word begin - // to do - // AddBreak(LastBreak, LastBreak + 155); + //ToDo + //AddBreak(LastBreak, LastBreak + 155); end; end; - isBreak := true; - // add break from text + isBreak := True; + //Add Break from Text AddBreak(LastBreak, NextPos); end - // text comes out of the text area -> createbreak + //Text comes out of the Text Area -> CreateBreak else if (glTextWidth(Copy(Value, LastBreak, NextPos - LastBreak + 1)) > W) then begin - // not the first word after break, so we don't have to break within a word + //Not the First word after Break, so we don't have to break within a word if (FirstWord > 1) then begin - // add break before actual position, because there the text fits the area + //Add Break before actual Position, because there the Text fits the Area AddBreak(LastBreak, LastPos); end - else // first word after break -> break within the word + else //First Word after Break -> Break within the Word begin - // to do - // AddBreak(LastBreak, LastBreak + 155); + //ToDo + //AddBreak(LastBreak, LastBreak + 155); end; end; //end; Inc(FirstWord) end; - // add ending + //Add Ending AddBreak(LastBreak, Length(Value)+1); end; @@ -263,34 +262,33 @@ var X2, Y2: real; Text2: UTF8String; I: integer; - Ticks: cardinal; begin - if Visible and (Size > 0) then + if Visible then begin SetFontStyle(Style); SetFontSize(Size); - SetFontItalic(false); + SetFontItalic(False); glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha); - // reflection - if Reflection then + //Reflection + if Reflection = true then SetFontReflection(true, ReflectionSpacing) else SetFontReflection(false,0); - // if selected set blink... + //if selected set blink... if SelectBool then begin - Ticks := SDL_GetTicks() div 550; - if Ticks <> STicks then - begin // change visability - STicks := Ticks; + I := SDL_GetTicks() div 550; + if I <> STicks then + begin //Change Visability + STicks := I; SelectBlink := Not SelectBlink; end; end; - {if (false) then // no width set draw as one long string + {if (False) then //no width set draw as one long string begin if not (SelectBool AND SelectBlink) then Text2 := Text @@ -309,20 +307,20 @@ begin end else begin} - // now use always: - // draw text as many strings + //now use allways: + //draw text as many strings Y2 := Y + MoveY; - for I := 0 to High(TextTiles) do + for I := 0 to high(TextTiles) do begin - if (not (SelectBool and SelectBlink)) or (I <> High(TextTiles)) then + if (not (SelectBool and SelectBlink)) or (I <> high(TextTiles)) then Text2 := TextTiles[I] else Text2 := TextTiles[I] + '|'; case Align of - 1: X2 := X + MoveX - glTextWidth(Text2)/2; { centered } - 2: X2 := X + MoveX - glTextWidth(Text2); { right aligned } - else X2 := X + MoveX; { left aligned (default) } + 0: X2 := X + MoveX; + 1: X2 := X + MoveX - glTextWidth(Text2)/2; + 2: X2 := X + MoveX - glTextWidth(Text2); end; SetFontPos(X2, Y2); @@ -355,14 +353,7 @@ begin Create(X, Y, 0, 0, 30, 0, 0, 0, 0, Text, false, 0, 0); end; -constructor TText.Create(ParX, ParY, ParW: real; - ParStyle: integer; - ParSize, ParColR, ParColG, ParColB: real; - ParAlign: integer; - const ParText: UTF8String; - ParReflection: boolean; - ParReflectionSpacing: real; - ParZ: real); +constructor TText.Create(ParX, ParY, ParW: real; ParStyle: integer; ParSize, ParColR, ParColG, ParColB: real; ParAlign: integer; const ParText: UTF8String; ParReflection: boolean; ParReflectionSpacing: real; ParZ:real); begin inherited Create; Alpha := 1; @@ -380,8 +371,8 @@ begin Align := ParAlign; SelectBool := false; Visible := true; - Reflection := ParReflection; - ReflectionSpacing := ParReflectionSpacing; + Reflection:= ParReflection; + ReflectionSpacing:= ParReflectionSpacing; end; end. diff --git a/unicode/src/screens/UScreenCredits.pas b/unicode/src/screens/UScreenCredits.pas index cff83d70..25fa96df 100644 --- a/unicode/src/screens/UScreenCredits.pas +++ b/unicode/src/screens/UScreenCredits.pas @@ -34,30 +34,30 @@ interface {$I switches.inc} uses - SysUtils, - UMenu, - SDL, - SDL_Image, - UDisplay, - UTexture, - gl, - UMusic, - UFiles, - UThemes, - UGraphicClasses; + SysUtils, + UMenu, + SDL, + SDL_Image, + UDisplay, + UTexture, + gl, + UMusic, + UFiles, + UThemes, + UGraphicClasses; type - TCreditsStages=(InitialDelay, Intro, MainPart, Outro); + TCreditsStages=(InitialDelay,Intro,MainPart,Outro); TScreenCredits = class(TMenu) public - Credits_X: real; - Credits_Time: cardinal; - Credits_Alpha: cardinal; - CTime: cardinal; - CTime_hold: cardinal; - ESC_Alpha: integer; + Credits_X: Real; + Credits_Time: Cardinal; + Credits_Alpha: Cardinal; + CTime: Cardinal; + CTime_hold: Cardinal; + ESC_Alpha: Integer; credits_entry: TTexture; credits_entry_dx: TTexture; @@ -89,16 +89,16 @@ type deluxe_slidein: cardinal; - CurrentScrollText: string; - NextScrollUpdate: real; - EndofLastScrollingPart: cardinal; - CurrentScrollStart, CurrentScrollEnd: integer; + CurrentScrollText: String; + NextScrollUpdate: Real; + EndofLastScrollingPart: Cardinal; + CurrentScrollStart, CurrentScrollEnd: Integer; CRDTS_Stage: TCreditsStages; - Fadeout: boolean; + Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; procedure onHide; override; @@ -108,12 +108,12 @@ type const Funky_Text: string = - 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you are hearing, '+ - 'all the people who put massive effort and work in new songs (do not forget UltraStar w/o songs would be nothing), ppl from '+ + 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you´re hearing, '+ + 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+ 'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+ 'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..'; - CRDTS_BG_FILE = 'credits_v5_bg.png'; + CRDTS_BG_FILE = 'credits_v5_bg.png'; CRDTS_OVL_FILE = 'credits_v5_overlay.png'; CRDTS_blindguard_FILE = 'names_blindguard.png'; CRDTS_blindy_FILE = 'names_blindy.png'; @@ -137,7 +137,7 @@ const OUTRO_ESC_FILE = 'outro-esc.png'; OUTRO_EXD_FILE = 'outro-exit-dark.png'; - Timings: array[0..21] of cardinal=( + Timings: array[0..21] of Cardinal=( 20, // 0 Delay before Start 149, // 1 End first Intro Zoom @@ -178,10 +178,10 @@ uses UCommon, UPath; -function TScreenCredits.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenCredits.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down case PressedKey of @@ -191,15 +191,15 @@ begin FadeTo(@ScreenMain); AudioPlayback.PlaySound(SoundLib.Back); end; -{ + { SDLK_SPACE: begin setlength(CTime_hold,length(CTime_hold)+1); CTime_hold[high(CTime_hold)]:=CTime; end; -} - end; // esac - end; // fi + } + end;//esac + end; //fi end; constructor TScreenCredits.Create; @@ -243,22 +243,22 @@ end; function TScreenCredits.Draw: boolean; begin DrawCredits; - Draw := true; + Draw:=true; end; procedure TScreenCredits.onShow; begin inherited; - CRDTS_Stage := InitialDelay; - Credits_X := 580; + CRDTS_Stage:=InitialDelay; + Credits_X := 580; deluxe_slidein := 0; - Credits_Alpha := 0; -// Music.SetLoop(true); loop loops not, shit + Credits_Alpha := 0; + //Music.SetLoop(true); loop loops not, shit AudioPlayback.Open(soundpath + 'wome-credits-tune.mp3'); // thank you wetue -// Music.Play; - CTime := 0; -// setlength(CTime_hold,0); + //Music.Play; + CTime:=0; + //setlength(CTime_hold,0); end; procedure TScreenCredits.onHide; @@ -268,17 +268,17 @@ end; Procedure TScreenCredits.Draw_FunkyText; var - S: integer; - X, Y, A: real; + S: Integer; + X,Y,A: Real; visibleText: string; begin SetFontSize(30); - // init ScrollingText + //Init ScrollingText if (CTime = Timings[7]) then begin - // set position of text - Credits_X := 600; + //Set Position of Text + Credits_X := 600; CurrentScrollStart := 1; CurrentScrollEnd := 1; end; @@ -291,8 +291,8 @@ begin for S := 1 to length(visibleText) do begin - Y := abs(sin((Credits_X + X) * 0.93 { * (((Credits_X + X)) / 1200) } / 100 * pi)); - SetFontPos(Credits_X + X, 538 - Y * (Credits_X + X) * (Credits_X + X) * (Credits_X + X) / 1000000); + Y := abs(sin((Credits_X+X)*0.93{*(((Credits_X+X))/1200)}/100*pi)); + SetFontPos(Credits_X+X, 538-Y*(Credits_X+X)*(Credits_X+X)*(Credits_X+X)/1000000); if (Credits_X + X > 32) then A := 17 @@ -301,10 +301,10 @@ begin else A := 0; - glColor4f(230 / 255 - 40 / 255 + Y * (Credits_X + X)/ 900, - 200 / 255 - 30 / 255 + Y * (Credits_X + X)/ 1000, - 155 / 255 - 20 / 255 + Y * (Credits_X + X)/ 1100, - A / 17); + glColor4f(230/255-40/255+Y*(Credits_X+X)/900, + 200/255-30/255+Y*(Credits_X+X)/1000, + 155/255-20/255+Y*(Credits_X+X)/1100, + A/17); glPrint(visibleText[S]); X := X + glTextWidth(visibleText[S]); end; @@ -323,53 +323,50 @@ begin inc(CurrentScrollEnd); end; end; -{ -// timing hack - X:=5; - SetFontStyle(2); - SetFontItalic(false); - SetFontSize(27); - glColor4f(1, 1, 1, 1); - for S := 0 to high(CTime_hold) do - begin - visibleText := inttostr(CTime_hold[S]); - SetFontPos (500, X); - glPrint(visibleText[0]); - X := X + 20; - end; -} + { // timing hack + X:=5; + SetFontStyle (2); + SetFontItalic(False); + SetFontSize(27); + glColor4f(1, 1, 1, 1); + for S:=0 to high(CTime_hold) do begin + visibleText:=inttostr(CTime_hold[S]); + SetFontPos (500, X); + glPrint (visibleText[0]); + X:=X+20; + end; + } end; procedure Start3D; begin - glMatrixMode(GL_PROJECTION); - glPushMatrix; - glLoadIdentity; - glFrustum(-0.3 * 4 / 3, 0.3 * 4 / 3, -0.3, 0.3, 1, 1000); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity; + glMatrixMode(GL_PROJECTION); + glPushMatrix; + glLoadIdentity; + glFrustum(-0.3*4/3,0.3*4/3,-0.3,0.3,1,1000); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity; end; - procedure End3D; begin - glMatrixMode(GL_PROJECTION); - glPopMatrix; - glMatrixMode(GL_MODELVIEW); + glMatrixMode(GL_PROJECTION); + glPopMatrix; + glMatrixMode(GL_MODELVIEW); end; procedure TScreenCredits.DrawCredits; var - T: cardinal; - Data: TFFTData; - j, k, l: cardinal; - f, g: real; - STime: cardinal; - Delay: cardinal; - myScale: real; - myAngle: real; + T: Cardinal; + Data: TFFTData; + j,k,l:cardinal; + f,g: Real; + STime:cardinal; + Delay:cardinal; + myScale: Real; + myAngle: Real; const - myLogoCoords: array[0..27,0..1] of cardinal = ( - ( 39,32),( 84,32),(100,16),(125,24), + myLogoCoords: Array[0..27,0..1] of Cardinal = ( + (39,32),(84,32),(100,16),(125,24), (154,31),(156,58),(168,32),(203,36), (258,34),(251,50),(274,93),(294,84), (232,54),(278,62),(319,34),(336,92), @@ -378,10 +375,10 @@ const (450,32),(485,34),(444,91),(486,93) ); begin - // dis does teh muiwk y0r to be translated :-) + //dis does teh muiwk y0r AudioPlayback.GetFFTData(Data); - Log.LogStatus('', ' JB-1'); + Log.LogStatus('',' JB-1'); T := SDL_GetTicks() div 33; if T <> Credits_Time then @@ -391,172 +388,165 @@ begin inc(CTime_hold); Credits_X := Credits_X-2; - Log.LogStatus('', ' JB-2'); - if (CRDTS_Stage=InitialDelay) and (CTime = Timings[0]) then + Log.LogStatus('',' JB-2'); + if (CRDTS_Stage=InitialDelay) and (CTime=Timings[0]) then begin -// CTime := Timings[20]; -// CRDTS_Stage := Outro; - CRDTS_Stage := Intro; - CTime := 0; + //CTime:=Timings[20]; + //CRDTS_Stage:=Outro; + CRDTS_Stage:=Intro; + CTime:=0; AudioPlayback.Play; end; - if (CRDTS_Stage = Intro) and (CTime = Timings[7]) then + if (CRDTS_Stage=Intro) and (CTime=Timings[7]) then begin - CRDTS_Stage := MainPart; + CRDTS_Stage:=MainPart; end; - if (CRDTS_Stage = MainPart) and (CTime = Timings[20]) then + if (CRDTS_Stage=MainPart) and (CTime=Timings[20]) then begin - CRDTS_Stage := Outro; + CRDTS_Stage:=Outro; end; end; - Log.LogStatus('', ' JB-3'); + Log.LogStatus('',' JB-3'); - // draw background - if CRDTS_Stage = InitialDelay then - begin - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - end + //draw background + if CRDTS_Stage=InitialDelay then + begin + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + end else - if CRDTS_Stage = Intro then - begin - Start3D; - glPushMatrix; + if CRDTS_Stage=Intro then + begin + Start3D; + glPushMatrix; - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); + glClearColor(0,0,0,0); + glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); - glEnable(GL_TEXTURE_2D); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glEnable(GL_BLEND); + glEnable(GL_TEXTURE_2D); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + glEnable(GL_BLEND); - if CTime < Timings[1] then - begin - myScale := 0.5 + 0.5 * (Timings[1] - CTime) / (Timings[1]); // slowly move layers together - myAngle := cos((CTime) * pi / ((Timings[1]) * 2)); // and make logo face towards camera - end - else - begin // this is the part when the logo stands still - myScale := 0.5; - myAngle := 0; - end; - if CTime > Timings[2] then - begin - myScale := 0.5 + 0.5 * (CTime - Timings[2]) / (Timings[3] - Timings[2]); // get some space between layers - myAngle := 0; - end; -// if CTime > Timings[3] then myScale := 1; // keep the space between layers - glTranslatef(0, 0, -5 + 0.5 * myScale); - if CTime > Timings[3] then - myScale := 1; // keep the space between layers - if CTime > Timings[3] then - begin // make logo rotate left and grow -// myScale := (CTime - Timings[4]) / (Timings[7] - Timings[4]); - glRotatef(20 * sqr(CTime - Timings[3]) / sqr((Timings[7] - Timings[3]) / 2), 0, 0, 1); - glScalef(1 + sqr(CTime - Timings[3]) / (32 * (Timings[7] - Timings[3])), 1 + sqr(CTime - Timings[3]) / (32 * (Timings[7] - Timings[3])), 1); - end; - if CTime < Timings[2] then - glRotatef(30 * myAngle, 0.5 * myScale + myScale, 1 + myScale, 0); -// glScalef(0.5, 0.5, 0.5); - glScalef(4/3, -1, 1); - glColor4f(1, 1, 1, 1); + if CTime < Timings[1] then begin + myScale:= 0.5+0.5*(Timings[1]-CTime)/(Timings[1]); // slowly move layers together + myAngle:=cos((CTime)*pi/((Timings[1])*2)); // and make logo face towards camera + end else begin // this is the part when the logo stands still + myScale:=0.5; + myAngle:=0; + end; + if CTime > Timings[2] then begin + myScale:= 0.5+0.5*(CTime-Timings[2])/(Timings[3]-Timings[2]); // get some space between layers + myAngle:=0; + end; + //if CTime > Timings[3] then myScale:=1; // keep the space between layers + glTranslatef(0,0,-5+0.5*myScale); + if CTime > Timings[3] then myScale:=1; // keep the space between layers + if CTime > Timings[3] then begin // make logo rotate left and grow + //myScale:=(CTime-Timings[4])/(Timings[7]-Timings[4]); + glRotatef(20*sqr(CTime-Timings[3])/sqr((Timings[7]-Timings[3])/2),0,0,1); + glScalef(1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1+sqr(CTime-Timings[3])/(32*(Timings[7]-Timings[3])),1); + end; + if CTime < Timings[2] then + glRotatef(30*myAngle,0.5*myScale+myScale,1+myScale,0); + //glScalef(0.5,0.5,0.5); + glScalef(4/3,-1,1); + glColor4f(1, 1, 1, 1); - glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.4 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.4 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.4 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.4 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.3 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.3 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.3 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.2 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.2 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.2 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.1 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.1 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.1 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 0 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 0 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 0 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 0 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.1 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.1 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.1 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.1 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.2 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.2 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.2 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.2 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.3 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.3 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.3 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.3 * myScale); - glEnd; - glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); - glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.22 * myScale); - glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.22 * myScale); - glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.22 * myScale); - glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.22 * myScale); - glEnd; - gldisable(gl_texture_2d); - glDisable(GL_BLEND); - - glPopMatrix; - End3D; - - // do some sparkling effects - if (CTime < Timings[1]) and (CTime > Timings[21]) then - begin - for k:= 1 to 3 do - begin - l := 410 + floor((CTime - Timings[21]) / (Timings[1] - Timings[21]) * (536 - 410)) + RandomRange(-5, 5); - j := floor((Timings[1] - CTime) / 22) + RandomRange(285, 301); - GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); - end; - end; + glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.4 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.4 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.4 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.4 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, -0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, -0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, -0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, -0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.1 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.1 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.1 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.1 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.2 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.2 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.2 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.2 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.3 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.3 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.3 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.3 * myScale); + glEnd; + glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum); + glbegin(gl_quads); + glTexCoord2f(0,0);glVertex3f(-1, -1, 0.22 * myScale); + glTexCoord2f(0,1);glVertex3f(-1, 1, 0.22 * myScale); + glTexCoord2f(1,1); glVertex3f(1, 1, 0.22 * myScale); + glTexCoord2f(1,0);glVertex3f(1, -1, 0.22 * myScale); + glEnd; + gldisable(gl_texture_2d); + glDisable(GL_BLEND); - // fade to white at end - if Ctime > Timings[6] then - begin - glColor4f(1, 1, 1, sqr(CTime - Timings[6]) * (CTime - Timings[6]) / sqr(Timings[7] - Timings[6])); - glEnable(GL_BLEND); - glBegin(GL_QUADS); - glVertex2f( 0, 0); - glVertex2f( 0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); - glEnd; - glDisable(GL_BLEND); - end; + glPopMatrix; + End3D; - end; + // do some sparkling effects + if (CTime < Timings[1]) and (CTime > Timings[21]) then + begin + for k:=1 to 3 do begin + l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5); + j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301); + GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0); + end; + end; + + // fade to white at end + if Ctime > Timings[6] then + begin + glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6])); + glEnable(GL_BLEND); + glBegin(GL_QUADS); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); + glEnd; + glDisable(GL_BLEND); + end; + + end; if (CRDTS_Stage=MainPart) then // main credits screen background, scroller, logo and girl begin @@ -568,10 +558,10 @@ begin glColor4f(1, 1, 1, 1); glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 600/1024); glVertex2f( 0, 600); - glTexCoord2f(800/1024, 600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024, 0); glVertex2f(800, 0); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); glEnd; glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); @@ -582,50 +572,38 @@ begin //######################################################################### // draw credits names - Log.LogStatus('', ' JB-4'); + + Log.LogStatus('',' JB-4'); // BlindGuard (rotate in from upper left, rotate out to lower right) - STime := Timings[9] - 10; - Delay := Timings[10] - Timings[9]; + STime:=Timings[9]-10; + Delay:=Timings[10]-Timings[9]; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -638,26 +616,23 @@ begin end; glPushMatrix; - gltranslatef(0, 329, 0); - if CTime <= STime + 10 then - glrotatef((CTime - STime) * 9 + 270, 0, 0, 1); - gltranslatef(223, 0, 0); - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - gltranslatef(223, 0, 0); - glrotatef((integer(CTime) - (integer(STime + Delay) - 10)) * -9, 0, 0, 1); - gltranslatef(-223, 0, 0); - end; + gltranslatef(0,329,0); + if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end; + gltranslatef(223,0,0); + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + gltranslatef(223,0,0); + glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1); + gltranslatef(-223,0,0); + end; glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -665,47 +640,35 @@ begin end; // Blindy (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right) - STime := Timings[10] - 10; - Delay := Timings[11] - Timings[10] + 5; + STime:=Timings[10]-10; + Delay:=Timings[11]-Timings[10]+5; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime+20) and (CTime<=STime+22) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+20) and (CTime<=STime+22) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -718,31 +681,28 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 20 then - begin - j := CTime - Stime; - glscalef(j * j / 400, j * j / 400, j * j / 400); - glrotatef(j * 18.0, 0, 0, 1); + gltranslatef(223,329,0); + if CTime <= STime+20 then begin + j:=CTime-Stime; + glscalef(j*j/400,j*j/400,j*j/400); + glrotatef(j*18.0,0,0,1); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(f*3,-f,0); + glscalef(1+j/10,1+j/10,1+j/10); + glrotatef(j*9.0,0,0,1); end; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := CTime - (STime + Delay - 10); - f := j * 10.0; - gltranslatef(f * 3, -f, 0); - glscalef(1 + j / 10, 1 + j / 10, 1 + j / 10); - glrotatef(j * 9.0, 0, 0, 1); - end; glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -750,47 +710,35 @@ begin end; // Canni (shift in from left, shift out to upper right) - STime := Timings[11] - 10; - Delay := Timings[12] - Timings[11] + 5; + STime:=Timings[11]-10; + Delay:=Timings[12]-Timings[11]+5; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -803,26 +751,23 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - begin - gltranslatef(((CTime - STime) * 21.0) - 210, 0, 0); + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(((CTime-STime)*21.0)-210,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=(CTime-(STime+Delay-10))*21; + gltranslatef(j,-j/2,0); end; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := (CTime - (STime + Delay - 10)) * 21; - gltranslatef(j, -j / 2, 0); - end; glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -830,47 +775,35 @@ begin end; // Commandio (flip in from down, flip out to upper right) - STime := Timings[12] - 10; - Delay := Timings[13] - Timings[12]; + STime:=Timings[12]-10; + Delay:=Timings[13]-Timings[12]; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -883,27 +816,25 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - f := 258.0 - 25.8 * (CTime - STime) + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=258.0-25.8*(CTime-STime) else - f := 0; - g := 0; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := CTime - (STime + Delay - 10); - g := 32.6 * j; - end; + f:=0; + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; glBindTexture(GL_TEXTURE_2D, credits_commandio.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163 + g - f * 1.5, -129 + f * 1.5 - g/2); - glTexCoord2f(0, 1); glVertex2f(-163 + g * 1.5, 129 - (g * 1.5 * 258 / 326)); - glTexCoord2f(1, 1); glVertex2f( 163 + g, 129 + g / 4); - glTexCoord2f(1, 0); glVertex2f( 163 + f * 1.5 + g / 4, -129 + f * 1.5 - g / 4); + glTexCoord2f(0,0);glVertex2f(-163+g-f*1.5, -129+f*1.5-g/2); + glTexCoord2f(0,1);glVertex2f(-163+g*1.5, 129-(g*1.5*258/326)); + glTexCoord2f(1,1); glVertex2f(163+g, 129+g/4); + glTexCoord2f(1,0);glVertex2f(163+f*1.5+g/4, -129+f*1.5-g/4); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -911,57 +842,46 @@ begin end; // lazy joker (just scrolls from left to right, no twinkling stars, no on-beat flashing) - STime := Timings[13] - 35; - Delay := Timings[14] - Timings[13] + 5; + STime:=Timings[13]-35; + Delay:=Timings[14]-Timings[13]+5; if CTime > STime then begin - k := 0; + k:=0; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) > 10) and ((CTime - STime) < 20) then - ESC_Alpha := 20; - ESC_Alpha := 10; - f := CTime - STime; - if CTime <= STime + 40 then - j := CTime - STime - else - j := 40; - if (CTime >= STime + Delay - 40) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j * j / 1600); + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)>10) and ((CTime-STime)<20) then ESC_Alpha:=20; + ESC_Alpha:=10; + f:=CTime-STime; + if CTime <=STime+40 then j:=CTime-STime else j:=40; + if (CTime >=STime+Delay-40) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j*j/1600); glPushMatrix; - gltranslatef(180 + (f - 70), 329, 0); + gltranslatef(180+(f-70),329,0); glBindTexture(GL_TEXTURE_2D, credits_lazyjoker.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -969,47 +889,36 @@ begin end; // Mog (flip in from right, flip out to lower right) - STime := Timings[14] - 10; - Delay := Timings[15] - Timings[14] + 5; + STime:=Timings[14]-10; + Delay:=Timings[15]-Timings[14]+5; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; + try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -1022,28 +931,26 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - f := 326.0 - 32.6 * (CTime - STime) + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) else - f := 0; - - g := 0; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := CTime - (STime + Delay - 10); - g := 32.6 * j; - end; + f:=0; + + g:=0; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + g:=32.6*j; + end; glBindTexture(GL_TEXTURE_2D, credits_mog.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163 + g * 1.5, -129 + g * 1.5); - glTexCoord2f(0, 1); glVertex2f(-163 + g * 1.2, 129 + g); - glTexCoord2f(1, 1); glVertex2f( 163 - f + g / 2, 129 + f * 1.5 + g / 4); - glTexCoord2f(1, 0); glVertex2f( 163 - f + g * 1.5, -129 - f * 1.5); + glTexCoord2f(0,0);glVertex2f(-163+g*1.5, -129+g*1.5); + glTexCoord2f(0,1);glVertex2f(-163+g*1.2, 129+g); + glTexCoord2f(1,1); glVertex2f(163-f+g/2, 129+f*1.5+g/4); + glTexCoord2f(1,0);glVertex2f(163-f+g*1.5, -129-f*1.5); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -1051,47 +958,35 @@ begin end; // Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing) - STime := Timings[15] - 10; - Delay := Timings[16] - Timings[15] + 5; + STime:=Timings[15]-10; + Delay:=Timings[16]-Timings[15]+5; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -1104,31 +999,28 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - begin - gltranslatef(223, 0, 0); - glrotatef((10 - (CTime - STime)) * 9, 0, 0, 1); - gltranslatef(-223, 0, 0); + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + gltranslatef(223,0,0); + glrotatef((10-(CTime-STime))*9,0,0,1); + gltranslatef(-223,0,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + f:=j*10.0; + gltranslatef(-f*2,-f,0); + glscalef(1-j/10,1-j/10,1-j/10); + glrotatef(-j*9.0,0,0,1); end; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := CTime - (STime + Delay - 10); - f := j * 10.0; - gltranslatef(-f * 2, -f, 0); - glscalef(1 - j / 10, 1 - j / 10, 1 - j / 10); - glrotatef(-j * 9.0, 0, 0, 1); - end; glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -1136,47 +1028,35 @@ begin end; // Skillmaster (shift in from lower right, rotate out to upper right) - STime := Timings[16] - 10; - Delay := Timings[17] - Timings[16] + 5; + STime:=Timings[16]-10; + Delay:=Timings[17]-Timings[16]+5; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -1189,31 +1069,28 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - begin - j := STime + 10 - CTime; - f := j * 10.0; - gltranslatef(+f * 2, +f / 2, 0); + gltranslatef(223,329,0); + if CTime <= STime+10 then begin + j:=STime+10-CTime; + f:=j*10.0; + gltranslatef(+f*2,+f/2,0); + end; + if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin + j:=CTime-(STime+Delay-10); + gltranslatef(0,-223,0); + glrotatef(integer(j)*-9,0,0,1); + gltranslatef(0,223,0); + glrotatef(j*9,0,0,1); end; - if CTime >= STime + Delay - 10 then - if CTime <= STime + Delay then - begin - j := CTime - (STime + Delay - 10); - gltranslatef(0, -223, 0); - glrotatef(integer(j) * -9, 0, 0, 1); - gltranslatef(0, 223, 0); - glrotatef(j * 9, 0, 0, 1); - end; glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163, -129); - glTexCoord2f(0, 1); glVertex2f(-163, 129); - glTexCoord2f(1, 1); glVertex2f( 163, 129); - glTexCoord2f(1, 0); glVertex2f( 163, -129); + glTexCoord2f(0,0);glVertex2f(-163, -129); + glTexCoord2f(0,1);glVertex2f(-163, 129); + glTexCoord2f(1,1); glVertex2f(163, 129); + glTexCoord2f(1,0);glVertex2f(163, -129); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); @@ -1221,47 +1098,35 @@ begin end; // WhiteShark (flip in from lower left, flip out to upper right) - STime := Timings[17] - 10; - Delay := Timings[18] - Timings[17]; + STime:=Timings[17]-10; + Delay:=Timings[18]-Timings[17]; if CTime > STime then begin - k := 0; - ESC_Alpha := 20; + k:=0; + ESC_Alpha:=20; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.25 then - ESC_Alpha := 5 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - if ((CTime - STime) < 20) then - ESC_Alpha := 20; - if CTime <= STime + 10 then - j := CTime - STime - else - j := 10; - if (CTime >= STime + Delay - 10) then - if (CTime <= STime + Delay) then - j := (STime + Delay) - CTime - else - j := 0; - glColor4f(1, 1, 1, ESC_Alpha / 20 * j / 10); - - if (CTime >= STime + 10) and (CTime <= STime + 12) then - begin + + if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha); + if ESC_Alpha >20 then ESC_Alpha:=20; + if ((CTime-STime)<20) then ESC_Alpha:=20; + if CTime <=STime+10 then j:=CTime-STime else j:=10; + if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0; + glColor4f(1, 1, 1, ESC_Alpha/20*j/10); + + if (CTime >= STime+10) and (CTime<=STime+12) then begin GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 0); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 1); GoldenRec.Spawn(RandomRange(65,390), RandomRange(200,460), 1, 16, 0, -1, PerfectLineTwinkle, 5); @@ -1274,20 +1139,20 @@ begin end; glPushMatrix; - gltranslatef(223, 329, 0); - if CTime <= STime + 10 then - f := 326.0 - 32.6 * (CTime - STime) + gltranslatef(223,329,0); + if CTime <= STime+10 then + f:=326.0-32.6*(CTime-STime) else - f := 0; + f:=0; - if (CTime >= STime + Delay - 10) and (CTime <= STime + Delay) then + if (CTime >= STime+Delay-10) and (CTime <= STime+Delay) then begin - j := CTime - (STime + Delay - 10); - g := 32.6 * j; + j:=CTime-(STime+Delay-10); + g:=32.6*j; end else begin - g := 0; + g:=0; end; glBindTexture(GL_TEXTURE_2D, credits_whiteshark.TexNum); @@ -1295,50 +1160,51 @@ begin glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); glbegin(gl_quads); - glTexCoord2f(0, 0); glVertex2f(-163 - f + g, -129 + f / 4 - g / 2); - glTexCoord2f(0, 1); glVertex2f(-163 - f / 4 + g, 129 + g / 2 + f / 4); - glTexCoord2f(1, 1); glVertex2f( 163 - f * 1.2 + g / 4, 129 + f / 2 - g / 4); - glTexCoord2f(1, 0); glVertex2f( 163 - f * 1.5 + g / 4, -129 + f * 1.5 + g / 4); + glTexCoord2f(0,0);glVertex2f(-163-f+g, -129+f/4-g/2); + glTexCoord2f(0,1);glVertex2f(-163-f/4+g, 129+g/2+f/4); + glTexCoord2f(1,1); glVertex2f(163-f*1.2+g/4, 129+f/2-g/4); + glTexCoord2f(1,0);glVertex2f(163-f*1.5+g/4, -129+f*1.5+g/4); glEnd; gldisable(gl_texture_2d); gldisable(GL_BLEND); glPopMatrix; end; - Log.LogStatus('', ' JB-103'); + + Log.LogStatus('',' JB-103'); // #################################################################### // do some twinkle stuff (kinda on beat) - if (CTime > Timings[8] ) and - (CTime < Timings[19]) then + if (CTime > Timings[8] ) and + (CTime < Timings[19] ) then begin k := 0; try - for j := 0 to 40 do + for j:=0 to 40 do begin - if (j < length(Data)) and - (k < length(Data)) then + if ( j < length( Data ) ) AND + ( k < length( Data ) ) then begin if Data[j] >= Data[k] then - k := j; + k:=j; end; end; except end; - if Data[k] > 0.2 then + if Data[k]>0.2 then begin - l := RandomRange(6, 16); - j := RandomRange(0, 27); + l := RandomRange(6,16); + j := RandomRange(0,27); GoldenRec.Spawn(myLogoCoords[j,0], myLogoCoords[j,1], 16-l, l, 0, -1, PerfectNote, 0); end; end; //################################################# - // draw the rest of the main screen (girl and logo) + // draw the rest of the main screen (girl and logo glEnable(GL_TEXTURE_2D); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1346,21 +1212,21 @@ begin glColor4f(1, 1, 1, 1); glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f(800-393, 0); - glTexCoord2f( 0, 600/1024); glVertex2f(800-393, 600); - glTexCoord2f(393/512, 600/1024); glVertex2f(800, 600); - glTexCoord2f(393/512, 0); glVertex2f(800, 0); + glTexCoord2f(0,0);glVertex2f(800-393, 0); + glTexCoord2f(0,600/1024);glVertex2f(800-393, 600); + glTexCoord2f(393/512,600/1024); glVertex2f(800, 600); + glTexCoord2f(393/512,0);glVertex2f(800, 0); glEnd; -{ + { glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 112/128); glVertex2f( 0, 112); - glTexCoord2f(497/512, 112/128); glVertex2f(497, 112); - glTexCoord2f(497/512, 0); glVertex2f(497, 0); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,112/128);glVertex2f(0, 112); + glTexCoord2f(497/512,112/128); glVertex2f(497, 112); + glTexCoord2f(497/512,0);glVertex2f(497, 0); glEnd; -} + } gldisable(gl_texture_2d); glDisable(GL_BLEND); @@ -1368,35 +1234,33 @@ begin // fade out at end of main part if Ctime > Timings[19] then begin - glColor4f(0, 0, 0, (CTime - Timings[19]) / (Timings[20] - Timings[19])); + glColor4f(0,0,0,(Ctime-Timings[19])/(Timings[20]-Timings[19])); glEnable(GL_BLEND); glBegin(GL_QUADS); - glVertex2f( 0, 0); - glVertex2f( 0, 600); - glVertex2f(800, 600); - glVertex2f(800, 0); + glVertex2f(0,0); + glVertex2f(0,600); + glVertex2f(800,600); + glVertex2f(800,0); glEnd; glDisable(GL_BLEND); end; end else - if (CRDTS_Stage = Outro) then + if (CRDTS_Stage=Outro) then begin - if CTime = Timings[20] then - begin - CTime_hold := 0; + if CTime=Timings[20] then begin + CTime_hold:=0; AudioPlayback.Stop; AudioPlayback.Open(soundpath + 'credits-outro-tune.mp3'); AudioPlayback.SetVolume(0.2); - AudioPlayback.SetLoop(true); + AudioPlayback.SetLoop(True); AudioPlayback.Play; end; - if CTime_hold > 231 then - begin + if CTime_hold > 231 then begin AudioPlayback.Play; - Ctime_hold := 0; + Ctime_hold:=0; end; - glClearColor(0, 0, 0, 0); + glClearColor(0,0,0,0); glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); // do something useful @@ -1408,36 +1272,34 @@ begin glColor4f(1, 1, 1, 1); glBindTexture(GL_TEXTURE_2D, outro_bg.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 600/1024); glVertex2f( 0, 600); - glTexCoord2f(800/1024, 600/1024); glVertex2f(800, 600); - glTexCoord2f(800/1024, 0); glVertex2f(800, 0); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,600/1024);glVertex2f(0, 600); + glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600); + glTexCoord2f(800/1024,0);glVertex2f(800, 0); glEnd; - // outro overlays - glColor4f(1, 1, 1, (1 + sin(CTime / 15)) / 3 + 1/3); + //outro overlays + glColor4f(1, 1, 1, (1+sin(CTime/15))/3+1/3); glBindTexture(GL_TEXTURE_2D, outro_esc.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f( 0, 0); - glTexCoord2f( 0, 223/256); glVertex2f( 0, 223); - glTexCoord2f(487/512, 223/256); glVertex2f(487, 223); - glTexCoord2f(487/512, 0); glVertex2f(487, 0); + glTexCoord2f(0,0);glVertex2f(0, 0); + glTexCoord2f(0,223/256);glVertex2f(0, 223); + glTexCoord2f(487/512,223/256); glVertex2f(487, 223); + glTexCoord2f(487/512,0);glVertex2f(487, 0); glEnd; - ESC_Alpha := 20; - if (RandomRange(0,20) > 18) and (ESC_Alpha = 20) then - ESC_Alpha := 0 - else - inc(ESC_Alpha); - if ESC_Alpha > 20 then - ESC_Alpha := 20; - glColor4f(1, 1, 1, ESC_Alpha / 20); + ESC_Alpha:=20; + if (RandomRange(0,20) > 18) and (ESC_Alpha=20) then + ESC_Alpha:=0 + else inc(ESC_Alpha); + if ESC_Alpha > 20 then ESC_Alpha:=20; + glColor4f(1, 1, 1, ESC_Alpha/20); glBindTexture(GL_TEXTURE_2D, outro_exd.TexNum); glbegin(gl_quads); - glTexCoord2f( 0, 0); glVertex2f(800-310, 600-247); - glTexCoord2f( 0, 247/256); glVertex2f(800-310, 600 ); - glTexCoord2f(310/512, 247/256); glVertex2f(800, 600 ); - glTexCoord2f(310/512, 0); glVertex2f(800, 600-247); + glTexCoord2f(0,0);glVertex2f(800-310, 600-247); + glTexCoord2f(0,247/256);glVertex2f(800-310, 600); + glTexCoord2f(310/512,247/256); glVertex2f(800, 600); + glTexCoord2f(310/512,0);glVertex2f(800, 600-247); glEnd; glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); @@ -1446,17 +1308,17 @@ begin // ... end; -{ + { // draw credits runtime counter - SetFontStyle (2); - SetFontItalic(false); + SetFontStyle (2); + SetFontItalic(False); SetFontSize(27); SetFontPos (5, 5); glColor4f(1, 1, 1, 1); -// RuntimeStr := 'CTime: ' + inttostr(floor(CTime / 30.320663991914489602156136106092)) + '.' + inttostr(floor(CTime / 3.0320663991914489602156136106092) - floor(CTime / 30.320663991914489602156136106092) * 10); - RuntimeStr := 'CTime: ' + inttostr(CTime); + //RuntimeStr:='CTime: '+inttostr(floor(CTime/30.320663991914489602156136106092))+'.'+inttostr(floor(CTime/3.0320663991914489602156136106092)-floor(CTime/30.320663991914489602156136106092)*10); + RuntimeStr:='CTime: '+inttostr(CTime); glPrint (RuntimeStr[1]); -} + } // make the stars shine GoldenRec.Draw; diff --git a/unicode/src/screens/UScreenEditConvert.pas b/unicode/src/screens/UScreenEditConvert.pas index 109a828b..835590ed 100644 --- a/unicode/src/screens/UScreenEditConvert.pas +++ b/unicode/src/screens/UScreenEditConvert.pas @@ -34,7 +34,6 @@ interface {$I switches.inc} uses - math, UMenu, SDL, {$IFDEF UseMIDIPort} @@ -138,7 +137,7 @@ uses function TScreenEditConvert.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -181,15 +180,15 @@ begin end; if Interaction = 2 then - begin + begin Selected := true; {$IFDEF UseMIDIPort} MidiFile.OnMidiEvent := nil; {$ENDIF} {for T := 0 to High(ATrack) do - begin + begin if ATrack[T].Hear then - begin + begin MidiTrack := MidiFile.GetTrack(T); MidiTrack.OnMidiEvent := MidiFile1MidiEvent; end; @@ -198,9 +197,9 @@ begin end; if Interaction = 3 then - begin + begin if SelectedNumber > 0 then - begin + begin Extract; SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false); end; @@ -211,16 +210,16 @@ begin SDLK_SPACE: begin // ATrack[Sel].Hear := not ATrack[Sel].Hear; - if Notes in ATrack[Sel].Status then - begin - ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; - if Lyrics in ATrack[Sel].Status then - ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] - else - ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; - end - else - ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; + if Notes in ATrack[Sel].Status then + begin + ATrack[Sel].Status := ATrack[Sel].Status - [Notes]; + if Lyrics in ATrack[Sel].Status then + ATrack[Sel].Status := ATrack[Sel].Status - [Lyrics] + else + ATrack[Sel].Status := ATrack[Sel].Status + [Lyrics]; + end + else + ATrack[Sel].Status := ATrack[Sel].Status + [Notes]; { if Selected then begin @@ -246,13 +245,13 @@ begin begin Inc(Sel); if Sel > High(ATrack) then - Sel := 0; + Sel := 0; end; SDLK_UP: begin Dec(Sel); if Sel < 0 then - Sel := High(ATrack); + Sel := High(ATrack); end; end; end; @@ -314,7 +313,7 @@ begin for N := 0 to High(ATrack[T].Note) do begin if (ATrack[T].Note[N].EventType = 9) and (ATrack[T].Note[N].Data2 > 0) then - begin + begin Nu := Length(Note); SetLength(Note, Nu + 1); Note[Nu].Start := Round(ATrack[T].Note[N].Start / Ticks); @@ -336,7 +335,7 @@ begin for N := 0 to High(ATrack[T].Note) do begin if (ATrack[T].Note[N].EventType = 15) then - begin + begin // Log.LogStatus('<' + Track[T].Note[N].Str + '>', 'MIDI'); AddLyric(Round(ATrack[T].Note[N].Start / Ticks), ATrack[T].Note[N].Str); end; @@ -454,6 +453,7 @@ begin AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF')); AddButtonText(20, 5, 0, 0, 0, 'Save'); + { MidiOut := TMidiOutput.Create(nil); // MidiOut.Close; // MidiOut.DeviceID := 0; @@ -493,11 +493,13 @@ begin Log.LogStatus(MidiOut.ProductName, 'MIDI'); MidiOut.Open; + if FileExists(ConversionFileName) then begin MidiFile.Filename := ConversionFileName; MidiFile.ReadFile; + Len := 0; Sel := 0; BPM := MidiFile.Bpm; @@ -577,7 +579,7 @@ var Bottom: real; X: real; Y: real; - Height: real; + H: real; YSkip: real; begin // draw static menu @@ -585,24 +587,20 @@ begin Y := 100; - Height := min(480, 40 * Length(ATrack)); - Bottom := Y + Height; + H := Length(ATrack)*40; + if H > 480 then + H := 480; + Bottom := Y + H; - if Length(ATrack) = 0 then // prevent crash with uncomplete code. - begin - Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0'); - YSkip := 40; - end - else - YSkip := Height / Length(ATrack); + YSkip := H / Length(ATrack); // select - DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); + DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8); // selected - now me use Status System for Count := 0 to High(ATrack) do if ATrack[Count].Hear then - DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); + DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3); glColor3f(0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -620,12 +618,12 @@ begin end; end; - DrawLine( 10, Y, 10, Bottom, 0, 0, 0); - DrawLine( 60, Y, 60, Bottom, 0, 0, 0); + DrawLine(10, Y, 10, Bottom, 0, 0, 0); + DrawLine(60, Y, 60, Bottom, 0, 0, 0); DrawLine(790, Y, 790, Bottom, 0, 0, 0); for Count := 0 to Length(ATrack) do - DrawLine(10, Y + Count*YSkip, 790, Y + Count*YSkip, 0, 0, 0); + DrawLine(10, Y+Count*YSkip, 790, Y+Count*YSkip, 0, 0, 0); for Count := 0 to High(ATrack) do begin @@ -638,21 +636,9 @@ begin for Count2 := 0 to High(ATrack[Count].Note) do begin if ATrack[Count].Note[Count2].EventType = 9 then - DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, - 3, - 3, - ColR[Count], - ColG[Count], - ColB[Count]); + DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]); if ATrack[Count].Note[Count2].EventType = 15 then - DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + 0.75*YSkip + Count*YSkip, - 60 + ATrack[Count].Note[Count2].Start/Len*725, - Y + YSkip + Count*YSkip, - ColR[Count], - ColG[Count], - ColB[Count]); + DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]); end; // playing line diff --git a/unicode/src/screens/UScreenEditHeader.pas b/unicode/src/screens/UScreenEditHeader.pas index fed226ba..2548069d 100644 --- a/unicode/src/screens/UScreenEditHeader.pas +++ b/unicode/src/screens/UScreenEditHeader.pas @@ -116,7 +116,7 @@ begin SDLK_RETURN: begin if Interaction = 1 then - begin + begin // Save; end; end; @@ -159,7 +159,7 @@ begin begin T := Interaction - 2 + TextTitle; if (Interaction >= 2) and (Interaction <= 13) and (Length(Text[T].Text) >= 1) then - begin + begin Text[T].DeleteLastLetter; SetRoundButtons; end; @@ -170,7 +170,7 @@ begin 32..255: begin if (Interaction >= 2) and (Interaction <= 13) then - begin + begin Text[Interaction - 2 + TextTitle].Text := Text[Interaction - 2 + TextTitle].Text + UCS4ToUTF8String(CharCode); SetRoundButtons; diff --git a/unicode/src/screens/UScreenEditSub.pas b/unicode/src/screens/UScreenEditSub.pas index 23ab427b..a892651a 100644 --- a/unicode/src/screens/UScreenEditSub.pas +++ b/unicode/src/screens/UScreenEditSub.pas @@ -133,11 +133,11 @@ uses ULanguage, UUnicodeUtils; -// Method for input parsing. If false is returned, GetNextWindow +// Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; function TScreenEditSub.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var - SDL_ModState: word; + SDL_ModState: Word; R: real; begin Result := true; @@ -206,7 +206,7 @@ begin begin // Paste text if SDL_ModState = KMOD_LCTRL then - begin + begin if Lines[0].Line[Lines[0].Current].HighNote >= Lines[0].Line[CopySrc].HighNote then PasteText else @@ -214,7 +214,7 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); end; end; @@ -334,7 +334,7 @@ begin SDLK_4: begin if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); @@ -342,14 +342,14 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then - begin + begin CopySentences(CopySrc, Lines[0].Current, 4); end; end; SDLK_5: begin if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT then - begin + begin CopySentence(CopySrc, Lines[0].Current); CopySentence(CopySrc+1, Lines[0].Current+1); CopySentence(CopySrc+2, Lines[0].Current+2); @@ -358,7 +358,7 @@ begin end; if SDL_ModState = KMOD_LCTRL + KMOD_LSHIFT + KMOD_LALT then - begin + begin CopySentences(CopySrc, Lines[0].Current, 5); end; end; @@ -401,21 +401,21 @@ begin SDLK_SLASH: begin if SDL_ModState = 0 then - begin + begin // Insert start of sentece if CurrentNote > 0 then DivideSentence; end; if SDL_ModState = KMOD_LSHIFT then - begin + begin // Join next sentence with current if Lines[0].Current < Lines[0].High then JoinSentence; end; if SDL_ModState = KMOD_LCTRL then - begin + begin // divide note DivideNote; end; @@ -450,7 +450,7 @@ begin SDLK_DELETE: begin if SDL_ModState = KMOD_LCTRL then - begin + begin // moves text to right in current sentence DeleteNote; end; @@ -466,24 +466,24 @@ begin begin // right if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then - CurrentNote := 0; + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + right if SDL_ModState = KMOD_LCTRL then - begin + begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); if CurrentNote = 0 then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; end; @@ -491,10 +491,10 @@ begin // shift + right if SDL_ModState = KMOD_LSHIFT then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); if CurrentNote = 0 then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Start); end; if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then @@ -503,7 +503,7 @@ begin // alt + right if SDL_ModState = KMOD_LALT then - begin + begin Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Inc(Lines[0].Line[Lines[0].Current].End_); @@ -511,7 +511,7 @@ begin // alt + ctrl + shift + right = move all from cursor to right if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then - begin + begin MoveAllToEnd(1); end; @@ -521,34 +521,34 @@ begin begin // left if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); if CurrentNote = -1 then - CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; // ctrl + left if SDL_ModState = KMOD_LCTRL then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); Inc(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = 0 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; end; // shift + left if SDL_ModState = KMOD_LSHIFT then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Start); // resizing sentences if CurrentNote = 0 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Start); end; @@ -559,9 +559,9 @@ begin // alt + left if SDL_ModState = KMOD_LALT then - begin + begin if Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length > 1 then - begin + begin Dec(Lines[0].Line[Lines[0].Current].Note[CurrentNote].Length); if CurrentNote = Lines[0].Line[Lines[0].Current].HighNote then Dec(Lines[0].Line[Lines[0].Current].End_); @@ -570,7 +570,7 @@ begin // alt + ctrl + shift + right = move all from cursor to left if SDL_ModState = KMOD_LALT + KMOD_LCTRL + KMOD_LSHIFT then - begin + begin MoveAllToEnd(-1); end; @@ -581,7 +581,7 @@ begin // skip to next sentence if SDL_ModState = 0 then - begin {$IFDEF UseMIDIPort} + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; {$endif} @@ -590,7 +590,7 @@ begin Inc(Lines[0].Current); CurrentNote := 0; if Lines[0].Current > Lines[0].High then - Lines[0].Current := 0; + Lines[0].Current := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -601,7 +601,7 @@ begin // decrease tone if SDL_ModState = KMOD_LCTRL then - begin + begin TransposeNote(-1); end; @@ -612,7 +612,7 @@ begin // skip to previous sentence if SDL_ModState = 0 then - begin + begin {$IFDEF UseMIDIPort} MidiOut.PutShort($81, Lines[0].Line[Lines[0].Current].Note[MidiLastNote].Tone + 60, 127); PlaySentenceMidi := false; @@ -622,7 +622,7 @@ begin Dec(Lines[0].Current); CurrentNote := 0; if Lines[0].Current = -1 then - Lines[0].Current := Lines[0].High; + Lines[0].Current := Lines[0].High; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.AddLine(Lines[0].Current); @@ -633,7 +633,7 @@ begin // increase tone if SDL_ModState = KMOD_LCTRL then - begin + begin TransposeNote(1); end; end; @@ -645,7 +645,7 @@ end; function TScreenEditSub.ParseInputEditText(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var - SDL_ModState: word; + SDL_ModState: Word; begin // used when in Text Edit Mode Result := true; @@ -682,11 +682,11 @@ begin begin // right if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Inc(CurrentNote); if CurrentNote > Lines[0].Line[Lines[0].Current].HighNote then - CurrentNote := 0; + CurrentNote := 0; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -695,11 +695,11 @@ begin begin // left if SDL_ModState = 0 then - begin + begin Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 0; Dec(CurrentNote); if CurrentNote = -1 then - CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; + CurrentNote := Lines[0].Line[Lines[0].Current].HighNote; Lines[0].Line[Lines[0].Current].Note[CurrentNote].Color := 1; Lyric.Selected := CurrentNote; end; @@ -880,7 +880,7 @@ begin Lines[0].Line[CNew].Start := Lines[0].Line[CStart].Note[NStart].Start; Lines[0].Line[CNew].Lyric := ''; Lines[0].Line[CNew].End_ := 0; - Lines[0].Line[CNew].BaseNote := 0;//High(integer); // TODO: High (integer) will causes a memory exception later in this procedure. Weird! + Lines[0].Line[CNew].BaseNote := 0;//High(Integer); // TODO: High (Integer) will causes a memory exception later in this procedure. Weird! Lines[0].Line[CNew].HighNote := -1; SetLength(Lines[0].Line[CNew].Note, 0); @@ -910,9 +910,9 @@ begin //recalculate BaseNote of the divided Sentence with Lines[0].Line[CStart] do begin - BaseNote := High(integer); + BaseNote := High(Integer); - for N := 0 to HighNote do + For N := 0 to HighNote do if Note[N].Tone < BaseNote then BaseNote := Note[N].Tone; end; @@ -994,7 +994,7 @@ begin C := Lines[0].Current; //Do Not delete Last Note - if (Lines[0].High > 0) or (Lines[0].Line[C].HighNote > 0) then + if (Lines[0].High > 0) OR (Lines[0].Line[C].HighNote > 0) then begin // we copy all notes from the next to the selected one @@ -1184,6 +1184,7 @@ begin CopySentence(Src + C, Dst + C); end; + constructor TScreenEditSub.Create; begin inherited Create; @@ -1252,7 +1253,7 @@ begin else Error := not CurrentSong.LoadSong(); except - Error := true; + Error := True; end; if Error then @@ -1284,7 +1285,7 @@ begin Lyric.Clear; Lyric.X := 400; Lyric.Y := 500; - Lyric.Align := atCenter; + Lyric.Align := center; Lyric.Size := 42; Lyric.ColR := 0; Lyric.ColG := 0; @@ -1317,6 +1318,7 @@ begin {$IFDEF UseMIDIPort} MidiPos := USTime.GetTime - MidiTime + MidiStart; + // stop the music if (MidiPos > MidiStop) then begin @@ -1335,6 +1337,7 @@ begin if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then begin + LastClick := AktBeat; {$IFDEF UseMIDIPort} if Pet > 0 then @@ -1426,8 +1429,7 @@ begin end; function TScreenEditSub.GetNoteName(Note: integer): string; -var - N1, N2: integer; +var N1, N2: integer; begin if (Note > 0) then begin diff --git a/unicode/src/screens/UScreenLevel.pas b/unicode/src/screens/UScreenLevel.pas index caf63a33..188b32f2 100644 --- a/unicode/src/screens/UScreenLevel.pas +++ b/unicode/src/screens/UScreenLevel.pas @@ -34,37 +34,30 @@ interface {$I switches.inc} uses - UMenu, - SDL, - UDisplay, - UMusic, - UFiles, - SysUtils, - UThemes; + UMenu, SDL, UDisplay, UMusic, UFiles, SysUtils, UThemes; type TScreenLevel = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; implementation -uses - UGraphic, - UMain, - UIni, - USong, - UTexture, - UUnicodeUtils; - -function TScreenLevel.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +uses UGraphic, + UMain, + UIni, + USong, + UTexture, + UUnicodeUtils; + +function TScreenLevel.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of diff --git a/unicode/src/screens/UScreenLoading.pas b/unicode/src/screens/UScreenLoading.pas index 429a3261..e52823be 100644 --- a/unicode/src/screens/UScreenLoading.pas +++ b/unicode/src/screens/UScreenLoading.pas @@ -46,16 +46,15 @@ type Fadeout: boolean; constructor Create; override; procedure onShow; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; end; implementation -uses - UGraphic, - UTime; +uses UGraphic, + UTime; -function TScreenLoading.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenLoading.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; end; diff --git a/unicode/src/screens/UScreenMain.pas b/unicode/src/screens/UScreenMain.pas index 8ce6307c..eb2e051e 100644 --- a/unicode/src/screens/UScreenMain.pas +++ b/unicode/src/screens/UScreenMain.pas @@ -52,7 +52,10 @@ type function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure onShow; override; - procedure SetInteraction(Num: integer); override; + procedure InteractNext; override; + procedure InteractPrev; override; + procedure InteractInc; override; + procedure InteractDec; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -77,7 +80,7 @@ function TScreenMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; var SDL_ModState: word; begin - Result := true; + Result := True; SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT + KMOD_LCTRL + KMOD_RCTRL + KMOD_LALT + KMOD_RALT); @@ -87,7 +90,7 @@ begin // check normal keys case UCS4UpperCase(CharCode) of Ord('Q'): begin - Result := false; + Result := False; Exit; end; Ord('C'): begin @@ -121,7 +124,7 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE: begin - Result := false; + Result := False; end; SDLK_RETURN: @@ -136,7 +139,7 @@ begin if (Ini.Players = 4) then PlayersPlay := 6; - ScreenName.Goto_SingScreen := false; + ScreenName.Goto_SingScreen := False; FadeTo(@ScreenName, SoundLib.Start); end else //show error message @@ -180,7 +183,7 @@ begin //Exit if Interaction = 5 then begin - Result := false; + Result := False; end; end; {** @@ -231,19 +234,36 @@ end; procedure TScreenMain.onShow; begin inherited; - - { display cursor (on moved) } - Display.SetCursor; - {** * Start background music *} SoundLib.StartBgMusic; end; -procedure TScreenMain.SetInteraction(Num: integer); +procedure TScreenMain.InteractNext; +begin + inherited InteractNext; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractPrev; +begin + inherited InteractPrev; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractDec; +begin + inherited InteractDec; + Text[TextDescription].Text := Theme.Main.Description[Interaction]; + Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; +end; + +procedure TScreenMain.InteractInc; begin - inherited SetInteraction(Num); + inherited InteractInc; Text[TextDescription].Text := Theme.Main.Description[Interaction]; Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction]; end; diff --git a/unicode/src/screens/UScreenName.pas b/unicode/src/screens/UScreenName.pas index dc2f14ef..64e90cc9 100644 --- a/unicode/src/screens/UScreenName.pas +++ b/unicode/src/screens/UScreenName.pas @@ -45,9 +45,9 @@ uses type TScreenName = class(TMenu) public - Goto_SingScreen: boolean; //If true then next Screen in SingScreen + Goto_SingScreen: Boolean; //If True then next Screen in SingScreen constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -63,13 +63,13 @@ uses UUnicodeUtils; -function TScreenName.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenName.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; var - I: integer; - SDL_ModState: word; + I: integer; +SDL_ModState: Word; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down SDL_ModState := SDL_GetModState and (KMOD_LSHIFT + KMOD_RSHIFT @@ -196,6 +196,7 @@ begin Button[Interaction].Text[0].Text := Ini.NameTemplate[11]; end; + SDLK_BACKSPACE: begin Button[Interaction].Text[0].DeleteLastLetter; @@ -223,7 +224,7 @@ begin else FadeTo(@ScreenLevel); - GoTo_SingScreen := false; + GoTo_SingScreen := False; end; // Up and Down could be done at the same time, @@ -245,6 +246,7 @@ begin LoadFromTheme(Theme.Name); + for I := 1 to 6 do AddButton(Theme.Name.ButtonPlayer[I]); @@ -260,14 +262,12 @@ begin for I := 1 to 6 do Button[I-1].Text[0].Text := Ini.Name[I-1]; - for I := 1 to PlayersPlay do - begin + for I := 1 to PlayersPlay do begin Button[I-1].Visible := true; Button[I-1].Selectable := true; end; - for I := PlayersPlay+1 to 6 do - begin + for I := PlayersPlay+1 to 6 do begin Button[I-1].Visible := false; Button[I-1].Selectable := false; end; diff --git a/unicode/src/screens/UScreenOpen.pas b/unicode/src/screens/UScreenOpen.pas index 718ef546..fa65a1df 100644 --- a/unicode/src/screens/UScreenOpen.pas +++ b/unicode/src/screens/UScreenOpen.pas @@ -92,7 +92,7 @@ begin Ord(' '), Ord('-'), Ord('.'), Ord(':'), Ord('\'): begin if Interaction = 0 then - begin + begin Text[TextN].Text := Text[TextN].Text + UCS4ToUTF8String(CharCode); end; end; @@ -123,7 +123,7 @@ begin SDLK_RETURN: begin if (Interaction = 2) then - begin + begin //Update Filename and go to last Screen ConversionFileName := Text[TextN].Text; AudioPlayback.PlaySound(SoundLib.Back); @@ -207,8 +207,7 @@ begin Interaction := 0; end; -(* -function TScreenEditSub.Draw: boolean; +(*function TScreenEditSub.Draw: boolean; var Min: integer; Sec: integer; @@ -220,7 +219,6 @@ end; procedure TScreenEditSub.Finish; begin // -end; -*) +end;*) end. diff --git a/unicode/src/screens/UScreenOptions.pas b/unicode/src/screens/UScreenOptions.pas index 24f1f3d7..ff2a3fe2 100644 --- a/unicode/src/screens/UScreenOptions.pas +++ b/unicode/src/screens/UScreenOptions.pas @@ -48,7 +48,7 @@ type public TextDescription: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractNext; override; procedure InteractPrev; override; @@ -63,10 +63,10 @@ uses UGraphic, UUnicodeUtils; -function TScreenOptions.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptions.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of diff --git a/unicode/src/screens/UScreenOptionsAdvanced.pas b/unicode/src/screens/UScreenOptionsAdvanced.pas index 65aec66f..a6564bf1 100644 --- a/unicode/src/screens/UScreenOptionsAdvanced.pas +++ b/unicode/src/screens/UScreenOptionsAdvanced.pas @@ -34,8 +34,8 @@ interface {$I switches.inc} uses - UMenu, SDL, + UMenu, UDisplay, UMusic, UFiles, @@ -46,7 +46,7 @@ type TScreenOptionsAdvanced = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -57,10 +57,10 @@ uses UUnicodeUtils, SysUtils; -function TScreenOptionsAdvanced.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptionsAdvanced.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -85,8 +85,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if SelInteraction = 7 then begin - if SelInteraction = 6 then - begin + if SelInteraction = 6 then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); @@ -100,8 +99,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then - begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; @@ -110,8 +108,7 @@ begin begin //SelectLoadAnimation Hidden because it is useless atm //if (SelInteraction >= 0) and (SelInteraction <= 6) then begin - if (SelInteraction >= 0) and (SelInteraction <= 5) then - begin + if (SelInteraction >= 0) and (SelInteraction <= 5) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -129,30 +126,13 @@ begin LoadFromTheme(Theme.OptionsAdvanced); //SelectLoadAnimation Hidden because it is useless atm - //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimationTranslated); - Theme.OptionsAdvanced.SelectScreenFade.showArrows := true; - Theme.OptionsAdvanced.SelectScreenFade.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFadeTranslated); - - Theme.OptionsAdvanced.SelectEffectSing.showArrows := true; - Theme.OptionsAdvanced.SelectEffectSing.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSingTranslated); - - Theme.OptionsAdvanced.SelectLineBonus.showArrows := true; - Theme.OptionsAdvanced.SelectLineBonus.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonusTranslated); - - Theme.OptionsAdvanced.SelectOnSongClick.showArrows := true; - Theme.OptionsAdvanced.SelectOnSongClick.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClickTranslated); - - Theme.OptionsAdvanced.SelectAskbeforeDel.showArrows := true; - Theme.OptionsAdvanced.SelectAskbeforeDel.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDelTranslated); - - Theme.OptionsAdvanced.SelectPartyPopup.showArrows := true; - Theme.OptionsAdvanced.SelectPartyPopup.oneItemOnly := true; - AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopupTranslated); + //AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation); + AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade); + AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing); + AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus); + AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick); + AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel); + AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup); AddButton(Theme.OptionsAdvanced.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/unicode/src/screens/UScreenOptionsGame.pas b/unicode/src/screens/UScreenOptionsGame.pas index 1e7bbb3a..c5af4ca2 100644 --- a/unicode/src/screens/UScreenOptionsGame.pas +++ b/unicode/src/screens/UScreenOptionsGame.pas @@ -40,15 +40,15 @@ uses UMusic, UFiles, UIni, - USongs, - UThemes; + UThemes, + USongs; type TScreenOptionsGame = class(TMenu) public old_Tabs, old_Sorting: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure RefreshSongs; end; @@ -60,12 +60,10 @@ uses UUnicodeUtils, SysUtils; -function TScreenOptionsGame.ParseInput(PressedKey: cardinal; - CharCode: UCS4Char; - PressedDown: boolean): boolean; +function TScreenOptionsGame.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if PressedDown then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -83,12 +81,12 @@ begin begin AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; + FadeTo(@ScreenOptions); end; SDLK_RETURN: begin - if SelInteraction = 6 then - begin + if SelInteraction = 6 then begin AudioPlayback.PlaySound(SoundLib.Back); RefreshSongs; FadeTo(@ScreenOptions); @@ -128,34 +126,15 @@ begin old_Sorting := Ini.Sorting; old_Tabs := Ini.Tabs; - Theme.OptionsGame.SelectPlayers.showArrows := true; - Theme.OptionsGame.SelectPlayers.oneItemOnly := true; AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers); - - Theme.OptionsGame.SelectDifficulty.showArrows := true; - Theme.OptionsGame.SelectDifficulty.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficultyTranslated); - - Theme.OptionsGame.SelectLanguage.showArrows := true; - Theme.OptionsGame.SelectLanguage.oneItemOnly := true; + AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty); AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage); - - Theme.OptionsGame.SelectTabs.showArrows := true; - Theme.OptionsGame.SelectTabs.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabsTranslated); - - Theme.OptionsGame.SelectSorting.showArrows := true; - Theme.OptionsGame.SelectSorting.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISortingTranslated); - - Theme.OptionsGame.SelectDebug.showArrows := true; - Theme.OptionsGame.SelectDebug.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebugTranslated); - - + AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs); + AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting); + AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug); AddButton(Theme.OptionsGame.ButtonExit); - if (Length(Button[0].Text) = 0) then + if (Length(Button[0].Text)=0) then AddButtonText(14, 20, Theme.Options.Description[7]); end; @@ -163,7 +142,7 @@ end; //Refresh Songs Patch procedure TScreenOptionsGame.RefreshSongs; begin - if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then +if (ini.Sorting <> old_Sorting) or (ini.Tabs <> old_Tabs) then ScreenSong.Refresh; end; diff --git a/unicode/src/screens/UScreenOptionsGraphics.pas b/unicode/src/screens/UScreenOptionsGraphics.pas index 2be3dd66..a0890dbe 100644 --- a/unicode/src/screens/UScreenOptionsGraphics.pas +++ b/unicode/src/screens/UScreenOptionsGraphics.pas @@ -46,7 +46,7 @@ type TScreenOptionsGraphics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -58,10 +58,10 @@ uses UUnicodeUtils, SysUtils; -function TScreenOptionsGraphics.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptionsGraphics.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -84,12 +84,10 @@ begin end; SDLK_RETURN: begin -{ if SelInteraction <= 1 then - begin +{ if SelInteraction <= 1 then begin Restart := true; end;} - if SelInteraction = 6 then - begin + if SelInteraction = 6 then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); // FIXME: changing the video mode does not work this way in windows @@ -107,16 +105,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction < 6) then - begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction < 6) then - begin + if (SelInteraction >= 0) and (SelInteraction < 6) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -132,29 +128,13 @@ begin inherited Create; LoadFromTheme(Theme.OptionsGraphics); - Theme.OptionsGraphics.SelectResolution.showArrows := true; - Theme.OptionsGraphics.SelectResolution.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); + AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution); + AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen); + AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); + AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer); + AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope); + AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize); - Theme.OptionsGraphics.SelectFullscreen.showArrows := true; - Theme.OptionsGraphics.SelectFullscreen.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullScreenTranslated); - - Theme.OptionsGraphics.SelectDepth.showArrows := true; - Theme.OptionsGraphics.SelectDepth.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth); - - Theme.OptionsGraphics.SelectVisualizer.showArrows := true; - Theme.OptionsGraphics.SelectVisualizer.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizerTranslated); - - Theme.OptionsGraphics.SelectOscilloscope.showArrows := true; - Theme.OptionsGraphics.SelectOscilloscope.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscopeTranslated); - - Theme.OptionsGraphics.SelectMovieSize.showArrows := true; - Theme.OptionsGraphics.SelectMovieSize.oneItemOnly := true; - AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSizeTranslated); AddButton(Theme.OptionsGraphics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/unicode/src/screens/UScreenOptionsLyrics.pas b/unicode/src/screens/UScreenOptionsLyrics.pas index d3fbf441..c8995ae4 100644 --- a/unicode/src/screens/UScreenOptionsLyrics.pas +++ b/unicode/src/screens/UScreenOptionsLyrics.pas @@ -46,7 +46,7 @@ type TScreenOptionsLyrics = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; end; @@ -57,10 +57,10 @@ uses UUnicodeUtils, SysUtils; -function TScreenOptionsLyrics.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptionsLyrics.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -83,8 +83,7 @@ begin end; SDLK_RETURN: begin - if SelInteraction = 3 then - begin + if SelInteraction = 3 then begin Ini.Save; AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenOptions); @@ -96,16 +95,14 @@ begin InteractPrev; SDLK_RIGHT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then - begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractInc; end; end; SDLK_LEFT: begin - if (SelInteraction >= 0) and (SelInteraction <= 3) then - begin + if (SelInteraction >= 0) and (SelInteraction <= 3) then begin AudioPlayback.PlaySound(SoundLib.Option); InteractDec; end; @@ -120,17 +117,11 @@ begin LoadFromTheme(Theme.OptionsLyrics); - Theme.OptionsLyrics.SelectLyricsFont.showArrows := true; - Theme.OptionsLyrics.SelectLyricsFont.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFontTranslated); + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont); + AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect); + //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!! + AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines); - Theme.OptionsLyrics.SelectLyricsEffect.showArrows := true; - Theme.OptionsLyrics.SelectLyricsEffect.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffectTranslated); - - Theme.OptionsLyrics.SelectNoteLines.showArrows := true; - Theme.OptionsLyrics.SelectNoteLines.oneItemOnly := true; - AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLinesTranslated); AddButton(Theme.OptionsLyrics.ButtonExit); if (Length(Button[0].Text)=0) then diff --git a/unicode/src/screens/UScreenOptionsRecord.pas b/unicode/src/screens/UScreenOptionsRecord.pas index cdacd5f6..0cf9eb37 100644 --- a/unicode/src/screens/UScreenOptionsRecord.pas +++ b/unicode/src/screens/UScreenOptionsRecord.pas @@ -95,7 +95,7 @@ type public constructor Create; override; function Draw: boolean; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure onHide; override; end; @@ -129,10 +129,10 @@ uses UUnicodeUtils, ULog; -function TScreenOptionsRecord.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptionsRecord.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -245,8 +245,6 @@ begin InputDeviceNames[DeviceIndex] := AudioInputProcessor.DeviceList[DeviceIndex].Name; end; // add device-selection slider (InteractionID: 0) - Theme.OptionsRecord.SelectSlideCard.showArrows := true; - Theme.OptionsRecord.SelectSlideCard.oneItemOnly := true; AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, CurrentDeviceIndex, InputDeviceNames); // init source-selection slider @@ -255,9 +253,6 @@ begin begin InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name; end; - - Theme.OptionsRecord.SelectSlideInput.showArrows := true; - Theme.OptionsRecord.SelectSlideInput.oneItemOnly := true; // add source-selection slider (InteractionID: 1) SelectInputSourceID := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput, InputDeviceCfg.Input, InputSourceNames); @@ -490,6 +485,7 @@ begin PreviewDeviceIndex := -1; end; + procedure TScreenOptionsRecord.DrawVolume(x, y, Width, Height: single); var x1, y1, x2, y2: single; @@ -807,7 +803,8 @@ begin end; end; - Result := true; + Result := True; end; + end. diff --git a/unicode/src/screens/UScreenOptionsSound.pas b/unicode/src/screens/UScreenOptionsSound.pas index f9a4c158..d0125a9d 100644 --- a/unicode/src/screens/UScreenOptionsSound.pas +++ b/unicode/src/screens/UScreenOptionsSound.pas @@ -34,8 +34,8 @@ interface {$I switches.inc} uses - UMenu, SDL, + UMenu, UDisplay, UMusic, UFiles, @@ -46,7 +46,7 @@ type TScreenOptionsSound = class(TMenu) public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; procedure onShow; override; end; @@ -61,14 +61,14 @@ uses function TScreenOptionsSound.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin - Result := true; + Result := True; if (PressedDown) then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of Ord('Q'): begin - Result := false; + Result := False; Exit; end; end; @@ -137,39 +137,19 @@ begin LoadFromTheme(Theme.OptionsSound); - Theme.OptionsSound.SelectSlideVoicePassthrough.showArrows := true; - Theme.OptionsSound.SelectSlideVoicePassthrough.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthroughTranslated); - - Theme.OptionsSound.SelectBackgroundMusic.showArrows := true; - Theme.OptionsSound.SelectBackgroundMusic.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusicTranslated); - + AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, + Ini.VoicePassthrough, IVoicePassthrough); + AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, + Ini.BackgroundMusicOption, IBackgroundMusic); + AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost); // TODO: - MicBoost needs to be moved to ScreenOptionsRecord - Theme.OptionsSound.SelectMicBoost.showArrows := true; - Theme.OptionsSound.SelectMicBoost.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoostTranslated); - - - Theme.OptionsSound.SelectClickAssist.showArrows := true; - Theme.OptionsSound.SelectClickAssist.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssistTranslated); - - Theme.OptionsSound.SelectBeatClick.showArrows := true; - Theme.OptionsSound.SelectBeatClick.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClickTranslated); - - Theme.OptionsSound.SelectThreshold.showArrows := true; - Theme.OptionsSound.SelectThreshold.oneItemOnly := true; + AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist); + AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick); AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.ThresholdIndex, IThreshold); - - Theme.OptionsSound.SelectSlidePreviewVolume.showArrows := true; - Theme.OptionsSound.SelectSlidePreviewVolume.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolumeTranslated); - - Theme.OptionsSound.SelectSlidePreviewFading.showArrows := true; - Theme.OptionsSound.SelectSlidePreviewFading.oneItemOnly := true; - AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFadingTranslated); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, + Ini.PreviewVolume, IPreviewVolume); + AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, + Ini.PreviewFading, IPreviewFading); AddButton(Theme.OptionsSound.ButtonExit); if (Length(Button[0].Text) = 0) then diff --git a/unicode/src/screens/UScreenOptionsThemes.pas b/unicode/src/screens/UScreenOptionsThemes.pas index aaee3fd9..64816d34 100644 --- a/unicode/src/screens/UScreenOptionsThemes.pas +++ b/unicode/src/screens/UScreenOptionsThemes.pas @@ -47,9 +47,9 @@ type private procedure ReloadTheme; public - SkinSelect: integer; + SkinSelect: Integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure InteractInc; override; procedure InteractDec; override; @@ -65,10 +65,10 @@ uses UUnicodeUtils, USkins; -function TScreenOptionsThemes.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenOptionsThemes.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -162,17 +162,11 @@ begin LoadFromTheme(Theme.OptionsThemes); - Theme.OptionsThemes.SelectTheme.showArrows := true; - Theme.OptionsThemes.SelectTheme.oneItemOnly := true; AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme); - Theme.OptionsThemes.SelectSkin.showArrows := true; - Theme.OptionsThemes.SelectSkin.oneItemOnly := true; SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin); - Theme.OptionsThemes.SelectColor.showArrows := true; - Theme.OptionsThemes.SelectColor.oneItemOnly := true; - AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColorTranslated); + AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor); AddButton(Theme.OptionsThemes.ButtonExit); if (Length(Button[0].Text)=0) then @@ -197,6 +191,7 @@ begin ScreenOptionsThemes.Interaction := self.Interaction; ScreenOptionsThemes.Draw; + Display.Draw; SwapBuffers; diff --git a/unicode/src/screens/UScreenPartyNewRound.pas b/unicode/src/screens/UScreenPartyNewRound.pas index 4c90b4c7..afcf2f9d 100644 --- a/unicode/src/screens/UScreenPartyNewRound.pas +++ b/unicode/src/screens/UScreenPartyNewRound.pas @@ -34,72 +34,73 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UDisplay, UMusic, UFiles, - SysUtils, UThemes; type TScreenPartyNewRound = class(TMenu) public //Texts: - TextRound1: cardinal; - TextRound2: cardinal; - TextRound3: cardinal; - TextRound4: cardinal; - TextRound5: cardinal; - TextRound6: cardinal; - TextRound7: cardinal; - - TextWinner1: cardinal; - TextWinner2: cardinal; - TextWinner3: cardinal; - TextWinner4: cardinal; - TextWinner5: cardinal; - TextWinner6: cardinal; - TextWinner7: cardinal; - - TextNextRound: cardinal; - TextNextRoundNo: cardinal; - TextNextPlayer1: cardinal; - TextNextPlayer2: cardinal; - TextNextPlayer3: cardinal; + TextRound1: Cardinal; + TextRound2: Cardinal; + TextRound3: Cardinal; + TextRound4: Cardinal; + TextRound5: Cardinal; + TextRound6: Cardinal; + TextRound7: Cardinal; + + TextWinner1: Cardinal; + TextWinner2: Cardinal; + TextWinner3: Cardinal; + TextWinner4: Cardinal; + TextWinner5: Cardinal; + TextWinner6: Cardinal; + TextWinner7: Cardinal; + + TextNextRound: Cardinal; + TextNextRoundNo: Cardinal; + TextNextPlayer1: Cardinal; + TextNextPlayer2: Cardinal; + TextNextPlayer3: Cardinal; //Statics - StaticRound1: cardinal; - StaticRound2: cardinal; - StaticRound3: cardinal; - StaticRound4: cardinal; - StaticRound5: cardinal; - StaticRound6: cardinal; - StaticRound7: cardinal; + StaticRound1: Cardinal; + StaticRound2: Cardinal; + StaticRound3: Cardinal; + StaticRound4: Cardinal; + StaticRound5: Cardinal; + StaticRound6: Cardinal; + StaticRound7: Cardinal; //Scores - TextScoreTeam1: cardinal; - TextScoreTeam2: cardinal; - TextScoreTeam3: cardinal; - TextNameTeam1: cardinal; - TextNameTeam2: cardinal; - TextNameTeam3: cardinal; + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; - TextTeam1Players: cardinal; - TextTeam2Players: cardinal; - TextTeam3Players: cardinal; + TextTeam1Players: Cardinal; + TextTeam2Players: Cardinal; + TextTeam3Players: Cardinal; + + StaticTeam1: Cardinal; + StaticTeam2: Cardinal; + StaticTeam3: Cardinal; + StaticNextPlayer1: Cardinal; + StaticNextPlayer2: Cardinal; + StaticNextPlayer3: Cardinal; - StaticTeam1: cardinal; - StaticTeam2: cardinal; - StaticTeam3: cardinal; - StaticNextPlayer1: cardinal; - StaticNextPlayer2: cardinal; - StaticNextPlayer3: cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -118,10 +119,10 @@ uses ULog, UUnicodeUtils; -function TScreenPartyNewRound.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPartyNewRound.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -218,19 +219,19 @@ end; procedure TScreenPartyNewRound.onShow; var - I: integer; - function GetTeamPlayers(const Num: byte): string; + I: Integer; + function GetTeamPlayers(const Num: Byte): String; var Players: array of UTF8String; - J: byte; - begin - if (Num-1 >= PartySession.Teams.NumTeams) then + //J: Byte; + begin // to-do : Party + if (Num-1 >= {PartySession.Teams.NumTeams}0) then exit; - //Create Players array + {//Create Players Array SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers); - for J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do - Players[J] := string(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name); + For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do + Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);} //Implode and Return Result := Language.Implode(Players); @@ -238,191 +239,193 @@ var begin inherited; - PartySession.StartRound; + // to-do : Party + //PartySession.StartRound; //Set Visibility of Round Infos - I := Length(PartySession.Rounds); + // to-do : Party + I := {Length(PartySession.Rounds)}0; if (I >= 1) then begin - Static[StaticRound1].Visible := true; - Text[TextRound1].Visible := true; - Text[TextWinner1].Visible := true; + Static[StaticRound1].Visible := True; + Text[TextRound1].Visible := True; + Text[TextWinner1].Visible := True; //Texts: - Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); - Text[TextWinner1].Text := PartySession.GetWinnerString(0); + //Text[TextRound1].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[0].Plugin].Name); + //Text[TextWinner1].Text := PartySession.GetWinnerString(0); end else begin - Static[StaticRound1].Visible := false; - Text[TextRound1].Visible := false; - Text[TextWinner1].Visible := false; + Static[StaticRound1].Visible := False; + Text[TextRound1].Visible := False; + Text[TextWinner1].Visible := False; end; if (I >= 2) then begin - Static[StaticRound2].Visible := true; - Text[TextRound2].Visible := true; - Text[TextWinner2].Visible := true; + Static[StaticRound2].Visible := True; + Text[TextRound2].Visible := True; + Text[TextWinner2].Visible := True; //Texts: - Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); - Text[TextWinner2].Text := PartySession.GetWinnerString(1); + //Text[TextRound2].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[1].Plugin].Name); + //Text[TextWinner2].Text := PartySession.GetWinnerString(1); end else begin - Static[StaticRound2].Visible := false; - Text[TextRound2].Visible := false; - Text[TextWinner2].Visible := false; + Static[StaticRound2].Visible := False; + Text[TextRound2].Visible := False; + Text[TextWinner2].Visible := False; end; if (I >= 3) then begin - Static[StaticRound3].Visible := true; - Text[TextRound3].Visible := true; - Text[TextWinner3].Visible := true; + Static[StaticRound3].Visible := True; + Text[TextRound3].Visible := True; + Text[TextWinner3].Visible := True; //Texts: - Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); - Text[TextWinner3].Text := PartySession.GetWinnerString(2); + //Text[TextRound3].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[2].Plugin].Name); + //Text[TextWinner3].Text := PartySession.GetWinnerString(2); end else begin - Static[StaticRound3].Visible := false; - Text[TextRound3].Visible := false; - Text[TextWinner3].Visible := false; + Static[StaticRound3].Visible := False; + Text[TextRound3].Visible := False; + Text[TextWinner3].Visible := False; end; if (I >= 4) then begin - Static[StaticRound4].Visible := true; - Text[TextRound4].Visible := true; - Text[TextWinner4].Visible := true; + Static[StaticRound4].Visible := True; + Text[TextRound4].Visible := True; + Text[TextWinner4].Visible := True; //Texts: - Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); - Text[TextWinner4].Text := PartySession.GetWinnerString(3); + //Text[TextRound4].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[3].Plugin].Name); + //Text[TextWinner4].Text := PartySession.GetWinnerString(3); end else begin - Static[StaticRound4].Visible := false; - Text[TextRound4].Visible := false; - Text[TextWinner4].Visible := false; + Static[StaticRound4].Visible := False; + Text[TextRound4].Visible := False; + Text[TextWinner4].Visible := False; end; if (I >= 5) then begin - Static[StaticRound5].Visible := true; - Text[TextRound5].Visible := true; - Text[TextWinner5].Visible := true; + Static[StaticRound5].Visible := True; + Text[TextRound5].Visible := True; + Text[TextWinner5].Visible := True; //Texts: - Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); - Text[TextWinner5].Text := PartySession.GetWinnerString(4); + //Text[TextRound5].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[4].Plugin].Name); + //Text[TextWinner5].Text := PartySession.GetWinnerString(4); end else begin - Static[StaticRound5].Visible := false; - Text[TextRound5].Visible := false; - Text[TextWinner5].Visible := false; + Static[StaticRound5].Visible := False; + Text[TextRound5].Visible := False; + Text[TextWinner5].Visible := False; end; if (I >= 6) then begin - Static[StaticRound6].Visible := true; - Text[TextRound6].Visible := true; - Text[TextWinner6].Visible := true; + Static[StaticRound6].Visible := True; + Text[TextRound6].Visible := True; + Text[TextWinner6].Visible := True; //Texts: - Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); - Text[TextWinner6].Text := PartySession.GetWinnerString(5); + //Text[TextRound6].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[5].Plugin].Name); + //Text[TextWinner6].Text := PartySession.GetWinnerString(5); end else begin - Static[StaticRound6].Visible := false; - Text[TextRound6].Visible := false; - Text[TextWinner6].Visible := false; + Static[StaticRound6].Visible := False; + Text[TextRound6].Visible := False; + Text[TextWinner6].Visible := False; end; if (I >= 7) then begin - Static[StaticRound7].Visible := true; - Text[TextRound7].Visible := true; - Text[TextWinner7].Visible := true; + Static[StaticRound7].Visible := True; + Text[TextRound7].Visible := True; + Text[TextWinner7].Visible := True; //Texts: - Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); - Text[TextWinner7].Text := PartySession.GetWinnerString(6); + //Text[TextRound7].Text := Language.Translate(DllMan.Plugins[PartySession.Rounds[6].Plugin].Name); + //Text[TextWinner7].Text := PartySession.GetWinnerString(6); end else begin - Static[StaticRound7].Visible := false; - Text[TextRound7].Visible := false; - Text[TextWinner7].Visible := false; + Static[StaticRound7].Visible := False; + Text[TextRound7].Visible := False; + Text[TextWinner7].Visible := False; end; //Display Scores - if (PartySession.Teams.NumTeams >= 1) then + {if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[0].Score); - Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[0].Name); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[0].Name); Text[TextTeam1Players].Text := GetTeamPlayers(1); - Text[TextScoreTeam1].Visible := true; - Text[TextNameTeam1].Visible := true; - Text[TextTeam1Players].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticNextPlayer1].Visible := true; + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Text[TextTeam1Players].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticNextPlayer1].Visible := True; end else begin - Text[TextScoreTeam1].Visible := false; - Text[TextNameTeam1].Visible := false; - Text[TextTeam1Players].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticNextPlayer1].Visible := false; + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Text[TextTeam1Players].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticNextPlayer1].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[1].Score); - Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[1].Name); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[1].Name); Text[TextTeam2Players].Text := GetTeamPlayers(2); - Text[TextScoreTeam2].Visible := true; - Text[TextNameTeam2].Visible := true; - Text[TextTeam2Players].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticNextPlayer2].Visible := true; + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Text[TextTeam2Players].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticNextPlayer2].Visible := True; end else begin - Text[TextScoreTeam2].Visible := false; - Text[TextNameTeam2].Visible := false; - Text[TextTeam2Players].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticNextPlayer2].Visible := false; + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Text[TextTeam2Players].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticNextPlayer2].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[2].Score); - Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[2].Name); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[2].Name); Text[TextTeam3Players].Text := GetTeamPlayers(3); - Text[TextScoreTeam3].Visible := true; - Text[TextNameTeam3].Visible := true; - Text[TextTeam3Players].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticNextPlayer3].Visible := true; + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Text[TextTeam3Players].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticNextPlayer3].Visible := True; end else begin - Text[TextScoreTeam3].Visible := false; - Text[TextNameTeam3].Visible := false; - Text[TextTeam3Players].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticNextPlayer3].Visible := false; + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Text[TextTeam3Players].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticNextPlayer3].Visible := False; end; //nextRound Texts @@ -431,26 +434,26 @@ begin if (PartySession.Teams.NumTeams >= 1) then begin Text[TextNextPlayer1].Text := PartySession.Teams.Teaminfo[0].Playerinfo[PartySession.Teams.Teaminfo[0].CurPlayer].Name; - Text[TextNextPlayer1].Visible := true; + Text[TextNextPlayer1].Visible := True; end else - Text[TextNextPlayer1].Visible := false; + Text[TextNextPlayer1].Visible := False; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextNextPlayer2].Text := PartySession.Teams.Teaminfo[1].Playerinfo[PartySession.Teams.Teaminfo[1].CurPlayer].Name; - Text[TextNextPlayer2].Visible := true; + Text[TextNextPlayer2].Visible := True; end else - Text[TextNextPlayer2].Visible := false; + Text[TextNextPlayer2].Visible := False; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextNextPlayer3].Text := PartySession.Teams.Teaminfo[2].Playerinfo[PartySession.Teams.Teaminfo[2].CurPlayer].Name; - Text[TextNextPlayer3].Visible := true; + Text[TextNextPlayer3].Visible := True; end else - Text[TextNextPlayer3].Visible := false; + Text[TextNextPlayer3].Visible := False; } end; procedure TScreenPartyNewRound.SetAnimationProgress(Progress: real); diff --git a/unicode/src/screens/UScreenPartyOptions.pas b/unicode/src/screens/UScreenPartyOptions.pas index b7226a5e..74c51b15 100644 --- a/unicode/src/screens/UScreenPartyOptions.pas +++ b/unicode/src/screens/UScreenPartyOptions.pas @@ -125,11 +125,11 @@ begin // Don't start when SinglePlayer Teams but only Multiplayer Plugins available OnlyMultiPlayer := true; for I := 0 to High(DLLMan.Plugins) do - begin + begin OnlyMultiPlayer := (OnlyMultiPlayer and DLLMan.Plugins[I].TeamModeOnly); end; if (OnlyMultiPlayer) and ((NumPlayer1 = 0) or (NumPlayer2 = 0) or ((NumPlayer3 = 0) and (NumTeams = 1))) then - begin + begin ScreenPopupError.ShowPopup(Language.Translate('ERROR_NO_PLUGINS')); Exit; end; @@ -137,11 +137,12 @@ begin Ini.Difficulty := SelectsS[SelectLevel].SelectedOption; Ini.SaveLevel; + //Save Num Teams: - PartySession.Teams.NumTeams := NumTeams + 2; + {PartySession.Teams.NumTeams := NumTeams + 2; PartySession.Teams.Teaminfo[0].NumPlayers := NumPlayer1+1; PartySession.Teams.Teaminfo[1].NumPlayers := NumPlayer2+1; - PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1; + PartySession.Teams.Teaminfo[2].NumPlayers := NumPlayer3+1;} //Save Playlist PlaylistMan.Mode := TSingMode( Playlist ); @@ -170,7 +171,8 @@ begin PlaylistMan.CurPlayList := Playlist2; //Start Party - PartySession.StartNewParty(Rounds + 2); + // to-do : Party + //PartySession.StartNewParty(Rounds + 2); AudioPlayback.PlaySound(SoundLib.Start); //Go to Player Screen @@ -256,8 +258,7 @@ begin end; procedure TScreenPartyOptions.SetPlaylist2; -var - I: integer; +var I: integer; begin case Playlist of 0: diff --git a/unicode/src/screens/UScreenPartyPlayer.pas b/unicode/src/screens/UScreenPartyPlayer.pas index 9f40983a..3e453058 100644 --- a/unicode/src/screens/UScreenPartyPlayer.pas +++ b/unicode/src/screens/UScreenPartyPlayer.pas @@ -45,26 +45,26 @@ uses type TScreenPartyPlayer = class(TMenu) public - Team1Name: cardinal; - Player1Name: cardinal; - Player2Name: cardinal; - Player3Name: cardinal; - Player4Name: cardinal; - - Team2Name: cardinal; - Player5Name: cardinal; - Player6Name: cardinal; - Player7Name: cardinal; - Player8Name: cardinal; - - Team3Name: cardinal; - Player9Name: cardinal; - Player10Name: cardinal; - Player11Name: cardinal; - Player12Name: cardinal; + Team1Name: Cardinal; + Player1Name: Cardinal; + Player2Name: Cardinal; + Player3Name: Cardinal; + Player4Name: Cardinal; + + Team2Name: Cardinal; + Player5Name: Cardinal; + Player6Name: Cardinal; + Player7Name: Cardinal; + Player8Name: Cardinal; + + Team3Name: Cardinal; + Player9Name: Cardinal; + Player10Name: Cardinal; + Player11Name: Cardinal; + Player12Name: Cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -79,11 +79,9 @@ uses UParty, UUnicodeUtils; -function TScreenPartyPlayer.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPartyPlayer.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; var - SDL_ModState: word; - I, J: integer; - + SDL_ModState: Word; procedure IntNext; begin repeat @@ -247,7 +245,7 @@ begin SDLK_RETURN: begin - //Save PlayerNames + {//Save PlayerNames for I := 0 to PartySession.Teams.NumTeams-1 do begin PartySession.Teams.Teaminfo[I].Name := PChar(Button[I*5].Text[0].Text); @@ -258,8 +256,8 @@ begin end; end; - AudioPlayback.PlaySound(SoundLib.Start); - FadeTo(@ScreenPartyNewRound); + AudioPlayback.PlayStart; + FadeTo(@ScreenPartyNewRound);} end; // Up and Down could be done at the same time, @@ -274,6 +272,8 @@ begin end; constructor TScreenPartyPlayer.Create; +//var +// I: integer; // Auto Removed, Unused Variable begin inherited Create; @@ -321,9 +321,9 @@ begin Button[10].Text[0].Text := Ini.NameTeam[2]; // Templates for Names Mod end - if (PartySession.Teams.NumTeams>=1) then + {If (PartySession.Teams.NumTeams>=1) then begin - Button[0].Visible := true; + Button[0].Visible := True; Button[1].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=1); Button[2].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=2); Button[3].Visible := (PartySession.Teams.Teaminfo[0].NumPlayers >=3); @@ -331,16 +331,16 @@ begin end else begin - Button[0].Visible := false; - Button[1].Visible := false; - Button[2].Visible := false; - Button[3].Visible := false; - Button[4].Visible := false; + Button[0].Visible := False; + Button[1].Visible := False; + Button[2].Visible := False; + Button[3].Visible := False; + Button[4].Visible := False; end; - if (PartySession.Teams.NumTeams>=2) then + If (PartySession.Teams.NumTeams>=2) then begin - Button[5].Visible := true; + Button[5].Visible := True; Button[6].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=1); Button[7].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=2); Button[8].Visible := (PartySession.Teams.Teaminfo[1].NumPlayers >=3); @@ -348,16 +348,16 @@ begin end else begin - Button[5].Visible := false; - Button[6].Visible := false; - Button[7].Visible := false; - Button[8].Visible := false; - Button[9].Visible := false; + Button[5].Visible := False; + Button[6].Visible := False; + Button[7].Visible := False; + Button[8].Visible := False; + Button[9].Visible := False; end; - if (PartySession.Teams.NumTeams>=3) then + If (PartySession.Teams.NumTeams>=3) then begin - Button[10].Visible := true; + Button[10].Visible := True; Button[11].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=1); Button[12].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=2); Button[13].Visible := (PartySession.Teams.Teaminfo[2].NumPlayers >=3); @@ -365,12 +365,12 @@ begin end else begin - Button[10].Visible := false; - Button[11].Visible := false; - Button[12].Visible := false; - Button[13].Visible := false; - Button[14].Visible := false; - end; + Button[10].Visible := False; + Button[11].Visible := False; + Button[12].Visible := False; + Button[13].Visible := False; + Button[14].Visible := False; + end; } end; diff --git a/unicode/src/screens/UScreenPartyScore.pas b/unicode/src/screens/UScreenPartyScore.pas index 4daa77c3..5934a389 100644 --- a/unicode/src/screens/UScreenPartyScore.pas +++ b/unicode/src/screens/UScreenPartyScore.pas @@ -34,42 +34,42 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UDisplay, UMusic, - SysUtils, UThemes; type TScreenPartyScore = class(TMenu) public - TextScoreTeam1: cardinal; - TextScoreTeam2: cardinal; - TextScoreTeam3: cardinal; - TextNameTeam1: cardinal; - TextNameTeam2: cardinal; - TextNameTeam3: cardinal; - StaticTeam1: cardinal; - StaticTeam1BG: cardinal; - StaticTeam1Deco: cardinal; - StaticTeam2: cardinal; - StaticTeam2BG: cardinal; - StaticTeam2Deco: cardinal; - StaticTeam3: cardinal; - StaticTeam3BG: cardinal; - StaticTeam3Deco: cardinal; - TextWinner: cardinal; - - DecoTex: array[0..5] of integer; - DecoColor: array[0..5] of Record - R, G, B: real; + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; + StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; + StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; + TextWinner: Cardinal; + + DecoTex: Array[0..5] of Integer; + DecoColor: Array[0..5] of Record + R, G, B: Real; end; - MaxScore: word; + MaxScore: Word; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -86,10 +86,10 @@ uses USkins, UUnicodeUtils; -function TScreenPartyScore.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPartyScore.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -106,21 +106,22 @@ begin SDLK_BACKSPACE : begin AudioPlayback.PlaySound(SoundLib.Start); - if (PartySession.CurRound < High(PartySession.Rounds)) then + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else // to-do : Party begin - PartySession.EndRound; + PartySession.EndRound; } FadeTo(@ScreenPartyWin); - end; + //end; end; SDLK_RETURN: begin AudioPlayback.PlaySound(SoundLib.Start); - if (PartySession.CurRound < High(PartySession.Rounds)) then + // to-do : Party + {if (PartySession.CurRound < High(PartySession.Rounds)) then FadeTo(@ScreenPartyNewRound) - else + else } FadeTo(@ScreenPartyWin); end; end; @@ -131,8 +132,8 @@ constructor TScreenPartyScore.Create; var // I: integer; // Auto Removed, Unused Variable Tex: TTexture; - R, G, B: real; - Color: integer; + R, G, B: Real; + Color: Integer; begin inherited Create; @@ -197,11 +198,12 @@ end; procedure TScreenPartyScore.onShow; var - I, J: integer; - Placings: array [0..5] of byte; + I, J: Integer; + Placings: Array [0..5] of Byte; begin inherited; + //Get Maxscore MaxScore := 0; @@ -216,10 +218,11 @@ begin begin Placings[I] := 0; for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do - if (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then + If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then Inc(Placings[I]); end; + //Set Static Length Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100; Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100; @@ -230,16 +233,16 @@ begin if Static[StaticTeam2].Texture.ScaleW > 99 then Static[StaticTeam2].Texture.ScaleW := 99; if Static[StaticTeam3].Texture.ScaleW > 99 then Static[StaticTeam3].Texture.ScaleW := 99; - //End Last Round - PartySession.EndRound; + //End Last Round // to-do : Party + //PartySession.EndRound; //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]); if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[0].Score); - Text[TextNameTeam1].Text := string(ScreenSingModi.TeamInfo.Teaminfo[0].Name); + Text[TextNameTeam1].Text := String(ScreenSingModi.TeamInfo.Teaminfo[0].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -250,25 +253,25 @@ begin Static[StaticTeam1Deco].Texture.ColB := DecoColor[Placings[0]].B; end; - Text[TextScoreTeam1].Visible := true; - Text[TextNameTeam1].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticTeam1BG].Visible := true; - Static[StaticTeam1Deco].Visible := true; + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; end else begin - Text[TextScoreTeam1].Visible := false; - Text[TextNameTeam1].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticTeam1BG].Visible := false; - Static[StaticTeam1Deco].Visible := false; + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[1].Score); - Text[TextNameTeam2].Text := string(ScreenSingModi.TeamInfo.Teaminfo[1].Name); + Text[TextNameTeam2].Text := String(ScreenSingModi.TeamInfo.Teaminfo[1].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -279,25 +282,25 @@ begin Static[StaticTeam2Deco].Texture.ColB := DecoColor[Placings[1]].B; end; - Text[TextScoreTeam2].Visible := true; - Text[TextNameTeam2].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticTeam2BG].Visible := true; - Static[StaticTeam2Deco].Visible := true; + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; end else begin - Text[TextScoreTeam2].Visible := false; - Text[TextNameTeam2].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticTeam2BG].Visible := false; - Static[StaticTeam2Deco].Visible := false; + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (ScreenSingModi.PlayerInfo.NumPlayers >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(ScreenSingModi.PlayerInfo.Playerinfo[2].Score); - Text[TextNameTeam3].Text := string(ScreenSingModi.TeamInfo.Teaminfo[2].Name); + Text[TextNameTeam3].Text := String(ScreenSingModi.TeamInfo.Teaminfo[2].Name); //Set Deco Texture if Theme.PartyScore.DecoTextures.ChangeTextures then @@ -308,19 +311,19 @@ begin Static[StaticTeam3Deco].Texture.ColB := DecoColor[Placings[2]].B; end; - Text[TextScoreTeam3].Visible := true; - Text[TextNameTeam3].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticTeam3BG].Visible := true; - Static[StaticTeam3Deco].Visible := true; + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; end else begin - Text[TextScoreTeam3].Visible := false; - Text[TextNameTeam3].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticTeam3BG].Visible := false; - Static[StaticTeam3Deco].Visible := false; + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; end; end; diff --git a/unicode/src/screens/UScreenPartyWin.pas b/unicode/src/screens/UScreenPartyWin.pas index caa1519e..dc3c5ac0 100644 --- a/unicode/src/screens/UScreenPartyWin.pas +++ b/unicode/src/screens/UScreenPartyWin.pas @@ -35,34 +35,34 @@ interface uses SDL, + SysUtils, UMenu, UDisplay, UMusic, - SysUtils, UThemes; type TScreenPartyWin = class(TMenu) public - TextScoreTeam1: cardinal; - TextScoreTeam2: cardinal; - TextScoreTeam3: cardinal; - TextNameTeam1: cardinal; - TextNameTeam2: cardinal; - TextNameTeam3: cardinal; - StaticTeam1: cardinal; - StaticTeam1BG: cardinal; - StaticTeam1Deco: cardinal; - StaticTeam2: cardinal; - StaticTeam2BG: cardinal; - StaticTeam2Deco: cardinal; - StaticTeam3: cardinal; - StaticTeam3BG: cardinal; - StaticTeam3Deco: cardinal; - TextWinner: cardinal; + TextScoreTeam1: Cardinal; + TextScoreTeam2: Cardinal; + TextScoreTeam3: Cardinal; + TextNameTeam1: Cardinal; + TextNameTeam2: Cardinal; + TextNameTeam3: Cardinal; + StaticTeam1: Cardinal; + StaticTeam1BG: Cardinal; + StaticTeam1Deco: Cardinal; + StaticTeam2: Cardinal; + StaticTeam2BG: Cardinal; + StaticTeam2Deco: Cardinal; + StaticTeam3: Cardinal; + StaticTeam3BG: Cardinal; + StaticTeam3Deco: Cardinal; + TextWinner: Cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; end; @@ -77,10 +77,10 @@ uses ULanguage, UUnicodeUtils; -function TScreenPartyWin.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPartyWin.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -138,13 +138,13 @@ begin end; procedure TScreenPartyWin.onShow; -var - I: integer; - Placing: TeamOrderArray; +//var +// I: Integer; // Auto Removed, Unused Variable +// Placing: Integer; // Auto Removed, Unused Variable - Function GetTeamColor(Team: byte): cardinal; + Function GetTeamColor(Team: Byte): Cardinal; var - NameString: string; + NameString: String; begin NameString := 'P' + InttoStr(Team+1) + 'Dark'; @@ -154,24 +154,25 @@ var begin inherited; + // to-do : Party //Get Team Placing - Placing := PartySession.GetTeamOrder; + //Placing := PartySession.GetTeamOrder; //Set Winnertext - Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); - if (PartySession.Teams.NumTeams >= 1) then + //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]); + {if (PartySession.Teams.NumTeams >= 1) then begin Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score); - Text[TextNameTeam1].Text := string(PartySession.Teams.TeamInfo[Placing[0]].Name); + Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name); - Text[TextScoreTeam1].Visible := true; - Text[TextNameTeam1].Visible := true; - Static[StaticTeam1].Visible := true; - Static[StaticTeam1BG].Visible := true; - Static[StaticTeam1Deco].Visible := true; + Text[TextScoreTeam1].Visible := True; + Text[TextNameTeam1].Visible := True; + Static[StaticTeam1].Visible := True; + Static[StaticTeam1BG].Visible := True; + Static[StaticTeam1Deco].Visible := True; //Set Static Color to Team Color - if (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam1BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[0]); if (I <> -1) then @@ -182,7 +183,7 @@ begin end; end; - if (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam1.Color = 'TeamColor') then begin I := GetTeamColor(Placing[0]); if (I <> -1) then @@ -195,26 +196,26 @@ begin end else begin - Text[TextScoreTeam1].Visible := false; - Text[TextNameTeam1].Visible := false; - Static[StaticTeam1].Visible := false; - Static[StaticTeam1BG].Visible := false; - Static[StaticTeam1Deco].Visible := false; + Text[TextScoreTeam1].Visible := False; + Text[TextNameTeam1].Visible := False; + Static[StaticTeam1].Visible := False; + Static[StaticTeam1BG].Visible := False; + Static[StaticTeam1Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 2) then begin Text[TextScoreTeam2].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[1]].Score); - Text[TextNameTeam2].Text := string(PartySession.Teams.TeamInfo[Placing[1]].Name); + Text[TextNameTeam2].Text := String(PartySession.Teams.TeamInfo[Placing[1]].Name); - Text[TextScoreTeam2].Visible := true; - Text[TextNameTeam2].Visible := true; - Static[StaticTeam2].Visible := true; - Static[StaticTeam2BG].Visible := true; - Static[StaticTeam2Deco].Visible := true; + Text[TextScoreTeam2].Visible := True; + Text[TextNameTeam2].Visible := True; + Static[StaticTeam2].Visible := True; + Static[StaticTeam2BG].Visible := True; + Static[StaticTeam2Deco].Visible := True; //Set Static Color to Team Color - if (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam2BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[1]); if (I <> -1) then @@ -225,7 +226,7 @@ begin end; end; - if (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam2.Color = 'TeamColor') then begin I := GetTeamColor(Placing[1]); if (I <> -1) then @@ -238,26 +239,26 @@ begin end else begin - Text[TextScoreTeam2].Visible := false; - Text[TextNameTeam2].Visible := false; - Static[StaticTeam2].Visible := false; - Static[StaticTeam2BG].Visible := false; - Static[StaticTeam2Deco].Visible := false; + Text[TextScoreTeam2].Visible := False; + Text[TextNameTeam2].Visible := False; + Static[StaticTeam2].Visible := False; + Static[StaticTeam2BG].Visible := False; + Static[StaticTeam2Deco].Visible := False; end; if (PartySession.Teams.NumTeams >= 3) then begin Text[TextScoreTeam3].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[2]].Score); - Text[TextNameTeam3].Text := string(PartySession.Teams.TeamInfo[Placing[2]].Name); + Text[TextNameTeam3].Text := String(PartySession.Teams.TeamInfo[Placing[2]].Name); - Text[TextScoreTeam3].Visible := true; - Text[TextNameTeam3].Visible := true; - Static[StaticTeam3].Visible := true; - Static[StaticTeam3BG].Visible := true; - Static[StaticTeam3Deco].Visible := true; + Text[TextScoreTeam3].Visible := True; + Text[TextNameTeam3].Visible := True; + Static[StaticTeam3].Visible := True; + Static[StaticTeam3BG].Visible := True; + Static[StaticTeam3Deco].Visible := True; //Set Static Color to Team Color - if (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam3BG.Color = 'TeamColor') then begin I := GetTeamColor(Placing[2]); if (I <> -1) then @@ -268,7 +269,7 @@ begin end; end; - if (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then + If (Theme.PartyWin.StaticTeam3.Color = 'TeamColor') then begin I := GetTeamColor(Placing[2]); if (I <> -1) then @@ -281,12 +282,12 @@ begin end else begin - Text[TextScoreTeam3].Visible := false; - Text[TextNameTeam3].Visible := false; - Static[StaticTeam3].Visible := false; - Static[StaticTeam3BG].Visible := false; - Static[StaticTeam3Deco].Visible := false; - end; + Text[TextScoreTeam3].Visible := False; + Text[TextNameTeam3].Visible := False; + Static[StaticTeam3].Visible := False; + Static[StaticTeam3BG].Visible := False; + Static[StaticTeam3Deco].Visible := False; + end; } end; procedure TScreenPartyWin.SetAnimationProgress(Progress: real); diff --git a/unicode/src/screens/UScreenPopup.pas b/unicode/src/screens/UScreenPopup.pas index 223d83ef..74107117 100644 --- a/unicode/src/screens/UScreenPopup.pas +++ b/unicode/src/screens/UScreenPopup.pas @@ -34,43 +34,44 @@ interface {$I switches.inc} uses - UMenu, SDL, + SysUtils, + UMenu, UMusic, UFiles, - SysUtils, UThemes; type TScreenPopupCheck = class(TMenu) public - Visible: boolean; //Whether the Menu should be Drawn + Visible: Boolean; //Whether the Menu should be Drawn constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; - procedure ShowPopup(msg: string); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; type TScreenPopupError = class(TMenu) { private - CurMenu: byte; //Num of the cur. Shown Menu} + CurMenu: Byte; //Num of the cur. Shown Menu} public - Visible: boolean; //Whether the Menu should be Drawn + Visible: Boolean; //Whether the Menu should be Drawn constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure onHide; override; - procedure ShowPopup(msg: string); + procedure ShowPopup(msg: String); function Draw: boolean; override; end; var -// ISelections: array of string; - SelectValue: integer; +// ISelections: Array of String; + SelectValue: Integer; + implementation @@ -85,10 +86,10 @@ uses UDisplay, UUnicodeUtils; -function TScreenPopupCheck.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPopupCheck.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -104,9 +105,9 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Display.CheckOK := false; - Display.NextScreenWithCheck := NIL; - Visible := false; + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; + Visible:=False; Result := false; end; @@ -123,14 +124,14 @@ begin ScreenSingModi.Finish; end; - Display.CheckOK := true; + Display.CheckOK:=True; end; 1: begin - Display.CheckOK := false; - Display.NextScreenWithCheck := NIL; + Display.CheckOK:=False; + Display.NextScreenWithCheck:=NIL; end; end; - Visible := false; + Visible:=False; Result := false; end; @@ -172,15 +173,15 @@ begin inherited; end; -procedure TScreenPopupCheck.ShowPopup(msg: string); +procedure TScreenPopupCheck.ShowPopup(msg: String); begin Interaction := 0; //Reset Interaction - Visible := true; //Set Visible + Visible := True; //Set Visible Text[0].Text := Language.Translate(msg); - Button[0].Visible := true; - Button[1].Visible := true; + Button[0].Visible := True; + Button[1].Visible := True; Button[0].Text[0].Text := Language.Translate('SONG_MENU_YES'); Button[1].Text[0].Text := Language.Translate('SONG_MENU_NO'); @@ -190,10 +191,10 @@ end; // error popup -function TScreenPopupError.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenPopupError.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down case PressedKey of @@ -205,13 +206,13 @@ begin SDLK_ESCAPE, SDLK_BACKSPACE : begin - Visible := false; + Visible:=False; Result := false; end; SDLK_RETURN: begin - Visible := false; + Visible:=False; Result := false; end; @@ -241,7 +242,7 @@ end; function TScreenPopupError.Draw: boolean; begin - Draw := inherited Draw; + Draw:=inherited Draw; end; procedure TScreenPopupError.onShow; @@ -254,26 +255,26 @@ procedure TScreenPopupError.onHide; begin end; -procedure TScreenPopupError.ShowPopup(msg: string); +procedure TScreenPopupError.ShowPopup(msg: String); begin Interaction := 0; //Reset Interaction - Visible := true; //Set Visible + Visible := True; //Set Visible Background.OnShow; { //dirty hack... Text[0] is invisible for some strange reason for i:=1 to high(Text) do if i-1 <= high(msg) then begin - Text[i].Visible := true; + Text[i].Visible:=True; Text[i].Text := msg[i-1]; end else begin - Text[i].Visible := false; + Text[i].Visible:=False; end;} - Text[0].Text := msg; + Text[0].Text:=msg; - Button[0].Visible := true; + Button[0].Visible := True; Button[0].Text[0].Text := 'OK'; end; diff --git a/unicode/src/screens/UScreenScore.pas b/unicode/src/screens/UScreenScore.pas index e07d0b9e..5c312938 100644 --- a/unicode/src/screens/UScreenScore.pas +++ b/unicode/src/screens/UScreenScore.pas @@ -129,7 +129,6 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; override; procedure onShow; override; procedure onShowFinish; override; function Draw: boolean; override; @@ -194,15 +193,6 @@ begin end; end; -function TScreenScore.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean; -begin - Result := True; - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin - //left-click anywhere sends return - ParseInput(SDLK_RETURN, 0, true); - end; -end; - constructor TScreenScore.Create; var Player: integer; diff --git a/unicode/src/screens/UScreenSing.pas b/unicode/src/screens/UScreenSing.pas index 86a811f4..05683c83 100644 --- a/unicode/src/screens/UScreenSing.pas +++ b/unicode/src/screens/UScreenSing.pas @@ -58,8 +58,9 @@ type type TScreenSing = class(TMenu) - protected + private VideoLoaded: boolean; + protected Paused: boolean; // pause mod LyricsSync: TLyricsSyncSource; NumEmptySentences: integer; @@ -127,13 +128,12 @@ uses UNote, URecord, USong, - UDisplay, UUnicodeUtils; // method for input parsing. if false is returned, getnextwindow // should be checked to know the next window to load; -function TScreenSing.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; +function TScreenSing.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; @@ -255,9 +255,6 @@ constructor TScreenSing.Create; begin inherited Create; - //too dangerous, a mouse button is quickly pressed by accident - RightMbESC := false; - fShowVisualization := false; fCurrentVideoPlaybackEngine := VideoPlayback; @@ -302,8 +299,8 @@ begin Static[StaticPausePopup].Visible := false; Lyrics := TLyricEngine.Create( - Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH, - Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH); + Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH, + Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH); LyricsSync := TLyricsSyncSource.Create(); end; @@ -628,9 +625,6 @@ end; procedure TScreenSing.onShowFinish; begin - // hide cursor on singscreen show - Display.SetCursor; - // start lyrics LyricsState.Resume(); @@ -651,7 +645,6 @@ begin end; Background.OnFinish; - Display.SetCursor; end; function TScreenSing.Draw: boolean; @@ -752,9 +745,10 @@ begin begin // Just call this once // when Screens = 2 - if (ScreenAct = 1) then + If (ScreenAct = 1) then fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); + fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); end; end; diff --git a/unicode/src/screens/UScreenSingModi.pas b/unicode/src/screens/UScreenSingModi.pas index 3ae5b7dc..b9c9365d 100644 --- a/unicode/src/screens/UScreenSingModi.pas +++ b/unicode/src/screens/UScreenSingModi.pas @@ -33,45 +33,74 @@ interface {$I switches.inc} -uses - UMenu, - UMusic, - SDL, - SysUtils, - UFiles, - UTime, - USongs, - UIni, - ULog, - UTexture, - ULyrics, - TextGL, - gl, - - UThemes, - UScreenSing, - ModiSDK; + +uses UMenu, + UMusic, + SDL, + SysUtils, + UFiles, + UTime, + USongs, + UIni, + ULog, + UTexture, + ULyrics, + TextGL, + gl, + + UThemes, + UScreenSing, + ModiSDK; type TScreenSingModi = class(TScreenSing) protected - + //paused: boolean; //Pause Mod + //PauseTime: Real; + //NumEmptySentences: integer; public - Winner: byte; //Who Wins + //TextTime: integer; + + //StaticP1: integer; + //StaticP1ScoreBG: integer; + //TextP1: integer; + //TextP1Score: integer; + + //StaticP2R: integer; + //StaticP2RScoreBG: integer; + //TextP2R: integer; + //TextP2RScore: integer; + + //StaticP2M: integer; + //StaticP2MScoreBG: integer; + //TextP2M: integer; + //TextP2MScore: integer; + + //StaticP3R: integer; + //StaticP3RScoreBG: integer; + //TextP3R: integer; + //TextP3RScore: integer; + + //Tex_Background: TTexture; + //FadeOut: boolean; + //LyricMain: TLyric; + //LyricSub: TLyric; + Winner: Byte; //Who Wins PlayerInfo: TPlayerInfo; TeamInfo: TTeamInfo; constructor Create; override; procedure onShow; override; //procedure onShowFinish; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure Finish; override; + //procedure Pause; //Pause Mod(Toggles Pause) end; type TCustomSoundEntry = record - Filename : string; + Filename : String; Stream : TAudioPlaybackStream; end; @@ -80,19 +109,11 @@ var CustomSounds: array of TCustomSoundEntry; //Procedured for Plugin -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//function Translate (const Name: PChar): PChar; -// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); - {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF} +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; +//function Translate (const Name: PChar): PChar; stdcall; +procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text +function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound +procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound //Utilys function ToSentences(Const Lines: TLines): TSentences; @@ -112,12 +133,12 @@ uses URecord, USkins; -// Method for input parsing. If false is returned, GetNextWindow +// Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; -function TScreenSingModi.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenSingModi.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down case PressedKey of @@ -143,7 +164,7 @@ end; function ToSentences(Const Lines: TLines): TSentences; var - I, J: integer; + I, J: Integer; begin Result.Current := Lines.Current; Result.High := Lines.High; @@ -178,7 +199,7 @@ end; procedure TScreenSingModi.onShow; var - I: integer; + I: Integer; begin inherited; @@ -200,14 +221,14 @@ begin PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]); PlayerInfo.Playerinfo[I].Score := 0; PlayerInfo.Playerinfo[I].Bar := 50; - PlayerInfo.Playerinfo[I].Enabled := true; + PlayerInfo.Playerinfo[I].Enabled := True; end; for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do begin PlayerInfo.Playerinfo[I].Score:= 0; PlayerInfo.Playerinfo[I].Bar := 0; - PlayerInfo.Playerinfo[I].Enabled := false; + PlayerInfo.Playerinfo[I].Enabled := False; end; {Case PlayersPlay of @@ -254,22 +275,18 @@ begin end; // Set Background (Little Workaround, maybe change sometime) - if (DLLMan.Selected.LoadBack) and (DLLMan.Selected.LoadSong) then + if (DLLMan.Selected.LoadBack) AND (DLLMan.Selected.LoadSong) then ScreenSing.Tex_Background := Tex_Background; Winner := 0; //Set Score Visibility - Scores.Visible := DLLMan.Selected.ShowScore; - - {if PlayersPlay = 1 then - begin + {if PlayersPlay = 1 then begin Text[TextP1Score].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore; end; - if (PlayersPlay = 2) or (PlayersPlay = 4) then - begin + if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -277,8 +294,7 @@ begin Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore; end; - if (PlayersPlay = 3) or (PlayersPlay = 6) then - begin + if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore; Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore; @@ -314,39 +330,116 @@ begin end; end; - Background.Draw; + //Show Score + if DLLMan.Selected.ShowScore then + begin + {//ScoreBG Mod + // set player colors + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); - // draw background picture (if any, and if no visualizations) - // when we don't check for visualizations the visualizations would - // be overdrawn by the picture when {UNDEFINED UseTexture} in UVisualizer - if (DllMan.Selected.LoadSong) and (DllMan.Selected.LoadBack) and (not fShowVisualization) then - SingDrawBackground; - // set player names (for 2 screens and only Singstar skin) - if ScreenAct = 1 then - begin - Text[TextP1].Text := 'P1'; - Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin - Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin - Text[TextP2R].Text := 'P2'; - Text[TextP2M].Text := 'P2'; - Text[TextP3R].Text := 'P3'; - end - Else if ScreenAct = 2 then - begin - case PlayersPlay of - 4: begin - Text[TextP1TwoP].Text := 'P3'; - Text[TextP2R].Text := 'P4'; - end; - 6: begin - Text[TextP1ThreeP].Text := 'P4'; - Text[TextP2M].Text := 'P5'; - Text[TextP3R].Text := 'P6'; - end; - end; // case - end; // if + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG, + Static[StaticP1TwoP].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P4Dark'); + + + + LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG, + Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark'); + LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark'); + + + + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P3Dark'); + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark'); + + + + end; + if ScreenAct = 2 then begin + LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG, + Static[StaticP1ThreeP].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG, + Static[StaticP2R].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG, + Static[StaticP3R].Texture.ColB, 'P6Dark'); + + + + + LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG, + Static[StaticP1ThreePScoreBG].Texture.ColB, 'P4Dark'); + LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG, + Static[StaticP2RScoreBG].Texture.ColB, 'P5Dark'); + LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG, + Static[StaticP3RScoreBG].Texture.ColB, 'P6Dark'); + + + + + end; + end; + //end ScoreBG Mod } + + // set player names (for 2 screens and only Singstar skin) + if ScreenAct = 1 then begin + Text[TextP1].Text := 'P1'; + Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin + Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin + Text[TextP2R].Text := 'P2'; + Text[TextP2M].Text := 'P2'; + Text[TextP3R].Text := 'P3'; + end; + + if ScreenAct = 2 then begin + case PlayersPlay of + 4: begin + Text[TextP1TwoP].Text := 'P3'; + Text[TextP2R].Text := 'P4'; + end; + 6: begin + Text[TextP1ThreeP].Text := 'P4'; + Text[TextP2M].Text := 'P5'; + Text[TextP3R].Text := 'P6'; + end; + end; // case + end; // if + // stereo <- and where iss P2M? or P3? Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX; @@ -358,6 +451,92 @@ begin Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX; + {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX; + Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;} + + // .. and scores + {if PlayersPlay = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1Score].Text := TextStr; + end; + + if PlayersPlay = 2 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + + if PlayersPlay = 3 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + + if PlayersPlay = 4 then begin + if ScreenAct = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + if ScreenAct = 2 then begin + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1TwoPScore].Text := TextStr; + + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2RScore].Text := TextStr; + end; + end; + + if PlayersPlay = 6 then begin + if ScreenAct = 1 then begin + TextStr := IntToStr(Player[0].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[1].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[2].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + if ScreenAct = 2 then begin + TextStr := IntToStr(Player[3].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP1ThreePScore].Text := TextStr; + + TextStr := IntToStr(Player[4].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP2MScore].Text := TextStr; + + TextStr := IntToStr(Player[5].ScoreTotalI); + while Length(TextStr) < 5 do TextStr := '0' + TextStr; + Text[TextP3RScore].Text := TextStr; + end; + end; } + + end; //ShowScore + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX; @@ -378,43 +557,30 @@ begin Text[TextTimeText].Text := Text[TextTimeText].Text + IntToStr(Sec); end; + // draw static menu (BG) + DrawBG; + + //Draw Background + if (DllMan.Selected.LoadSong) AND (DllMan.Selected.LoadBack) then + SingDrawBackground; + // update and draw movie -{ if ShowFinish and CurrentSong.VideoLoaded and DllMan.Selected.LoadVideo then - begin +{ if ShowFinish and CurrentSong.VideoLoaded AND DllMan.Selected.LoadVideo then begin UpdateSmpeg; // this only draws end;} - // update and draw movie - if (ShowFinish and (VideoLoaded or fShowVisualization) and DllMan.Selected.LoadVideo) then - begin - if assigned(fCurrentVideoPlaybackEngine) then - begin - // Just call this once - // when Screens = 2 - if (ScreenAct = 1) then - fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime()); - - fCurrentVideoPlaybackEngine.DrawGL(ScreenAct); - end; - end; - // draw static menu (FG) DrawFG; - if ShowFinish then - begin + if ShowFinish then begin if DllMan.Selected.LoadSong then begin - if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then - begin + if (not AudioPlayback.Finished) and ((CurrentSong.Finish = 0) or (LyricsState.GetCurrentTime*1000 <= CurrentSong.Finish)) then begin //Pause Mod: if not Paused then Sing(Self); // analyze song - end - else - begin - if not FadeOut then - begin + end else begin + if not FadeOut then begin Finish; FadeOut := true; FadeTo(@ScreenPartyScore); @@ -430,9 +596,6 @@ begin GoldenRec.SpawnRec; //GoldenNoteStarsTwinkle Mod - //Draw Score - Scores.Draw; - //Update PlayerInfo for I := 0 to PlayerInfo.NumPlayers-1 do begin @@ -443,15 +606,14 @@ begin end; end; - if ((ShowFinish) and (not Paused)) then + if ((ShowFinish) AND (NOT Paused)) then begin if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) then begin - if not FadeOut then - begin - Finish; - FadeOut := true; - FadeTo(@ScreenPartyScore); + if not FadeOut then begin + Finish; + FadeOut := true; + FadeTo(@ScreenPartyScore); end; end; end; @@ -475,12 +637,14 @@ begin {Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX; Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;} + Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX; Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX; {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX; Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;} + for S := 1 to 1 do Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX; @@ -501,13 +665,13 @@ Winner := DllMan.PluginFinish(PlayerInfo); //DLLMan.UnLoadPlugin; end; -function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture; +function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall; var - Texname, EXT: string; + Texname, EXT: String; Tex: TTexture; begin //Get texture Name - TexName := Skin.GetTextureFileName(string(Name)); + TexName := Skin.GetTextureFileName(String(Name)); //Get File Typ Ext := ExtractFileExt(TexName); if (uppercase(Ext) = '.JPG') then @@ -524,11 +688,10 @@ end; { function Translate (const Name: PChar): PChar; stdcall; begin - Result := PChar(Language.Translate(string(Name))); + Result := PChar(Language.Translate(String(Name))); end; } -//Procedure to Print Text -procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar); +procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text begin SetFontItalic ((Style and 128) = 128); SetFontStyle(Style and 7); @@ -536,15 +699,14 @@ begin // used by Hold_The_Line / TeamDuell SetFontSize(Size); SetFontPos (X, Y); - glPrint (Language.Translate(string(Text))); + glPrint (Language.Translate(String(Text))); end; -//Procedure that loads a Custom Sound -function LoadSound(const Name: PChar): cardinal; +function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound var Stream: TAudioPlaybackStream; - i: integer; - Filename: string; + i: Integer; + Filename: String; begin //Search for Sound in already loaded Sounds Filename := UpperCase(SoundPath + Name); @@ -557,7 +719,7 @@ begin end; end; - Stream := AudioPlayback.OpenSound(SoundPath + string(Name)); + Stream := AudioPlayback.OpenSound(SoundPath + String(Name)); if (Stream = nil) then begin Result := 0; @@ -569,8 +731,7 @@ begin Result := High(CustomSounds); end; -//Plays a Custom Sound -procedure PlaySound(const Index: cardinal); +procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound begin if (Index <= High(CustomSounds)) then AudioPlayback.PlaySound(CustomSounds[Index].Stream); diff --git a/unicode/src/screens/UScreenSong.pas b/unicode/src/screens/UScreenSong.pas index 00d90930..da725a59 100644 --- a/unicode/src/screens/UScreenSong.pas +++ b/unicode/src/screens/UScreenSong.pas @@ -33,23 +33,24 @@ interface {$I switches.inc} + uses - SysUtils, - SDL, - UCommon, - UDisplay, - UFiles, - UIni, - ULanguage, - ULog, UMenu, - UMenuEqualizer, + SDL, UMusic, - USong, + UFiles, + UTime, + UDisplay, USongs, - UTexture, + SysUtils, + UCommon, + ULog, UThemes, - UTime; + UTexture, + ULanguage, + USong, + UIni, + UMenuEqualizer; type TScreenSong = class(TMenu) @@ -110,6 +111,7 @@ type StaticNonParty: array of cardinal; TextNonParty: array of cardinal; + constructor Create; override; procedure SetScroll; //procedure SetScroll1; @@ -119,7 +121,6 @@ type procedure SetScroll5; procedure SetScroll6; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; function Draw: boolean; override; procedure GenerateThumbnails(); procedure onShow; override; @@ -141,7 +142,7 @@ type //procedures for Menu procedure StartSong; procedure OpenEditor; - procedure DoJoker(Team: byte); + procedure DoJoker(Team: Byte); procedure SelectPlayers; procedure UnloadDetailedCover; @@ -177,7 +178,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := Low(CatSongs.Song) to High(Catsongs.Song) do + for I := low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -198,7 +199,7 @@ begin if CatSongs.VisibleSongs > 0 then begin I2:= 0; - for I := Low(CatSongs.Song) to High(Catsongs.Song) do + for I := low(CatSongs.Song) to High(Catsongs.Song) do begin if CatSongs.Song[I].Visible then inc(I2); @@ -242,13 +243,14 @@ begin end; //Show Cat in Top Left Mod End -// Method for input parsing. If false is returned, GetNextWindow + +// Method for input parsing. If False is returned, GetNextWindow // should be checked to know the next window to load; function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; var I: integer; I2: integer; - SDL_ModState: word; + SDL_ModState: Word; UpperLetter: UCS4Char; TempStr: UTF8String; begin @@ -284,7 +286,7 @@ begin //Jump To Titel if (SDL_ModState = (KMOD_LALT or KMOD_LSHIFT)) then begin - for I := 1 to High(CatSongs.Song) do + for I := 1 to high(CatSongs.Song) do begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin @@ -307,7 +309,7 @@ begin //Jump to Artist else if (SDL_ModState = KMOD_LALT) then begin - for I := 1 to High(CatSongs.Song) do + for I := 1 to high(CatSongs.Song) do begin if (CatSongs.Song[(I + Interaction) mod I2].Visible) then begin @@ -405,25 +407,25 @@ begin if (Songs.SongList.Count > 0) and (Mode = smNormal) then begin - if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then // random category + if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then //Random Category begin - I2 := 0; // count cats - for I := 0 to High(CatSongs.Song) do + I2 := 0; //Count Cats + for I:= 0 to high(CatSongs.Song) do begin if CatSongs.Song[I].Main then Inc(I2); end; - I2 := Random(I2 + 1); // random and include I2 + I2 := Random(I2)+1; //Zufall - // find cat: - for I := 0 to High(CatSongs.Song) do + //Find Cat: + for I:= 0 to high(CatSongs.Song) do begin if CatSongs.Song[I].Main then Dec(I2); - if (I2 <= 0) then + if (I2<=0) then begin - // show cat in top left mod + //Show Cat in Top Left Mod ShowCatTL (I); Interaction := I; @@ -436,38 +438,38 @@ begin end; end; end - else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then // random in all categories + else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then //random in All Categorys begin repeat - I2 := Random(High(CatSongs.Song) + 1); + I2 := Random(high(CatSongs.Song)+1) + 1; until (not CatSongs.Song[I2].Main); - // search cat + //Search Cat for I := I2 downto 0 do begin if CatSongs.Song[I].Main then break; end; - // in I is now the categorie in I2 the song + //In I is now the categorie in I2 the song - // choose cat + //Choose Cat CatSongs.ShowCategoryList; - // show cat in top left mod + //Show Cat in Top Left Mod ShowCatTL (I); CatSongs.ClickCategoryButton(I); SelectNext; - // Fix: not existing song selected: - //if (I + 1 = I2) then - Inc(I2); + //Fix: Not Existing Song selected: + //if (I+1=I2) then + Inc(I2); - // choose song - SkipTo(I2 - I); + //Choose Song + SkipTo(I2-I); end - else // random in one category + else //Random in one Category begin SkipTo(Random(CatSongs.VisibleSongs)); end; @@ -499,7 +501,7 @@ begin break; end; if (I <= 1) then - Interaction := High(CatSongs.Song) + Interaction := high(CatSongs.Song) else Interaction := I - 1; @@ -511,6 +513,7 @@ begin //Show Cat in Top Left Mod HideCatTL; + //Show Wrong Song when Tabs on Fix SelectNext; FixSelected; @@ -616,13 +619,13 @@ begin begin I := Interaction; if I <= 0 then - I := 1; + I := 1; while not catsongs.Song[I].Main do begin Inc (I); - if (I > High(catsongs.Song)) then - I := Low(catsongs.Song); + if (I > high(catsongs.Song)) then + I := low(catsongs.Song); end; Interaction := I; @@ -658,15 +661,15 @@ begin I := Interaction; I2 := 0; if I <= 0 then - I := 1; + I := 1; while not catsongs.Song[I].Main or (I2 = 0) do begin if catsongs.Song[I].Main then Inc(I2); Dec (I); - if (I < Low(catsongs.Song)) then - I := High(catsongs.Song); + if (I < low(catsongs.Song)) then + I := high(catsongs.Song); end; Interaction := I; @@ -712,61 +715,41 @@ begin end; SDLK_1: - begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then + begin //Joker // to-do : Party + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[0].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_2: begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[1].Joker); SelectRandomSong; SetJoker; - end; + end; } end; SDLK_3: begin //Joker - if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then + {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then begin //Use Joker Dec(PartySession.Teams.Teaminfo[2].Joker); SelectRandomSong; SetJoker; - end; + end; } end; end; end; // if (PressedDown) end; -function TScreenSong.ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; -begin - Result := true; - - if RightMbESC and (MouseButton = SDL_BUTTON_RIGHT) and BtnDown then - //if RightMbESC is set, send ESC keypress - Result:=ParseInput(SDLK_ESCAPE, 0, true); - - //song scrolling with mousewheel - if (MouseButton = SDL_BUTTON_WHEELDOWN) and BtnDown then - ParseInput(SDLK_RIGHT, 0, true); - - if (MouseButton = SDL_BUTTON_WHEELUP) and BtnDown then - ParseInput(SDLK_LEFT, 0, true); - - //LMB anywhere starts - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - ParseInput(SDLK_RETURN, 0, true); -end; - constructor TScreenSong.Create; var i: integer; @@ -828,6 +811,7 @@ begin GenerateThumbnails(); + // Randomize Patch Randomize; @@ -982,6 +966,7 @@ begin if CatSongs.Song[B].Visible then Inc(VisInt); + if VisCount <= 6 then begin Typ := 0; @@ -1010,6 +995,7 @@ begin end; + // hide all buttons for B := 0 to High(Button) do begin @@ -1027,6 +1013,7 @@ begin end; } + if Typ = 0 then begin for B := 0 to High(Button) do @@ -1323,26 +1310,27 @@ begin if Button[B].Visible then // optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed begin - Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms + + Z := (1 + cos(Factor)) / 2; + Z2 := (1 + 2*Z) / 3; - Z := (1 + cos(Factor)) / 2; - Z2 := (1 + 2*Z) / 3; - Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs - Button[B].Z := Z / 2 + 0.3; + Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs + Button[B].Z := Z / 2 + 0.3; - Button[B].W := Theme.Song.Cover.H * Z2; + Button[B].W := Theme.Song.Cover.H * Z2; - //Button[B].Y := {50 +} 140 + 50 - 50 * Z2; - Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; - Button[B].H := Button[B].W; + //Button[B].Y := {50 +} 140 + 50 - 50 * Z2; + Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ; + Button[B].H := Button[B].W; end; end; end else begin //Change Pos of all Buttons - for B := Low(Button) to High(Button) do + for B := low(Button) to high(Button) do begin Button[B].Visible := CatSongs.Song[B].Visible; //Adjust Visibility if Button[B].Visible then //Only Change Pos for Visible Buttons @@ -1370,6 +1358,7 @@ begin Diff := (Button[B].H - Theme.Song.Cover.H)/2; + X := Sin(Angle*1.3)*0.9; Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff; @@ -1379,9 +1368,9 @@ begin // limit-bg-covers hack if (abs(VS/2-abs(Pos))>10) then - Button[B].Visible := false; + Button[B].Visible := false; if VS > 25 then - VS:=25; + VS:=25; // end of limit-bg-covers hack if Pos < 0 then @@ -1399,6 +1388,7 @@ begin Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5; + Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H; Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52); @@ -1408,6 +1398,7 @@ begin end; end; + procedure TScreenSong.onShow; begin inherited; @@ -1471,7 +1462,7 @@ begin AudioPlayback.SetVolume(1.0); // if preview is deactivated: load musicfile now - if (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then + If (IPreviewVolumeVals[Ini.PreviewVolume] = 0) then AudioPlayback.Open(CatSongs.Song[Interaction].Path + CatSongs.Song[Interaction].Mp3); // if hide then stop music (for party mode popup on exit) @@ -1731,40 +1722,41 @@ var I, I2: integer; begin case PlaylistMan.Mode of - smNormal: // all songs just select random song + smNormal: //All Songs Just Select Random Song begin - // when tabs are activated then use tab method + //When Tabs are activated then use Tab Method if (Ini.TabsAtStartup = 1) then begin repeat - I2 := Low(CatSongs.Song) + Random(High(CatSongs.Song) + 1 - Low(CatSongs.Song)); + I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1; until CatSongs.Song[I2].Main = false; - // search cat - for I := I2 downto Low(CatSongs.Song) do + //Search Cat + for I := I2 downto low(CatSongs.Song) do begin if CatSongs.Song[I].Main then break; end; - // I is the cat number, I2 is the no of the song within this cat + //In I ist jetzt die Kategorie in I2 der Song + //I is the CatNum, I2 is the No of the Song within this Cat - // choose cat + //Choose Cat CatSongs.ShowCategoryList; - // show cat in top left mod - ShowCatTL(I); + //Show Cat in Top Left Mod + ShowCatTL (I); CatSongs.ClickCategoryButton(I); SelectNext; - // choose song - SkipTo(I2 - I); + //Choose Song + SkipTo(I2-I); end - // when tabs are deactivated use easy method + //When Tabs are deactivated use easy Method else SkipTo(Random(CatSongs.VisibleSongs)); end; - smPartyMode: // one category select category and select random song + smPartyMode: //One Category Select Category and Select Random Song begin CatSongs.ShowCategoryList; CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList); @@ -1775,7 +1767,7 @@ begin SkipTo(Random(CatSongs.VisibleSongs)); end; - smPlaylistRandom: // playlist: select playlist and select random song + smPlaylistRandom: //Playlist: Select Playlist and Select Random Song begin PlaylistMan.SetPlayList(PlaylistMan.CurPlayList); @@ -1792,8 +1784,10 @@ end; procedure TScreenSong.SetJoker; begin // If Party Mode + // to-do : Party if Mode = smPartyMode then //Show Joker that are available begin + (* if (PartySession.Teams.NumTeams >= 1) then begin Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1); @@ -1844,6 +1838,7 @@ begin Static[StaticTeam3Joker4].Visible := false; Static[StaticTeam3Joker5].Visible := false; end; + *) end else begin //Hide all @@ -1875,19 +1870,19 @@ begin //Set Visibility of Party Statics and Text Visible := (Mode = smPartyMode); - for I := 0 to High(StaticParty) do + for I := 0 to high(StaticParty) do Static[StaticParty[I]].Visible := Visible; - for I := 0 to High(TextParty) do + for I := 0 to high(TextParty) do Text[TextParty[I]].Visible := Visible; //Set Visibility of Non Party Statics and Text Visible := not Visible; - for I := 0 to High(StaticNonParty) do + for I := 0 to high(StaticNonParty) do Static[StaticNonParty[I]].Visible := Visible; - for I := 0 to High(TextNonParty) do + for I := 0 to high(TextNonParty) do Text[TextNonParty[I]].Visible := Visible; end; @@ -1932,8 +1927,9 @@ begin end; //Team No of Team (0-5) -procedure TScreenSong.DoJoker (Team: byte); +procedure TScreenSong.DoJoker (Team: Byte); begin + { if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= Team + 1) and (PartySession.Teams.Teaminfo[Team].Joker > 0) then @@ -1943,6 +1939,7 @@ begin SelectRandomSong; SetJoker; end; + } end; //Detailed Cover Unloading. Unloads the Detailed, uncached Cover of the cur. Song diff --git a/unicode/src/screens/UScreenSongJumpto.pas b/unicode/src/screens/UScreenSongJumpto.pas index 7405742a..b6979f63 100644 --- a/unicode/src/screens/UScreenSongJumpto.pas +++ b/unicode/src/screens/UScreenSongJumpto.pas @@ -34,9 +34,9 @@ interface {$I switches.inc} uses + SDL, SysUtils, UMenu, - SDL, UDisplay, UMusic, UFiles, @@ -47,20 +47,20 @@ type TScreenSongJumpto = class(TMenu) private //For ChangeMusic - fLastPlayed: integer; - fVisible: boolean; + fLastPlayed: Integer; + fVisible: Boolean; fSelectType: TSongFilter; - fVisSongs: integer; + fVisSongs: Integer; - procedure SetTextFound(const Count: cardinal); + procedure SetTextFound(Count: Cardinal); //Visible //Whether the Menu should be Drawn //Whether the Menu should be Drawn - procedure SetVisible(Value: boolean); + procedure SetVisible(Value: Boolean); public constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; function Draw: boolean; override; @@ -80,10 +80,10 @@ uses ULog, UUnicodeUtils; -function TScreenSongJumpto.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenSongJumpto.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys if (IsAlphaNumericChar(CharCode) or @@ -100,7 +100,7 @@ begin case PressedKey of SDLK_BACKSPACE: begin - if (Interaction = 0) and (Length(Button[0].Text[0].Text) > 0) then + if (Interaction = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin Button[0].Text[0].DeleteLastLetter(); SetTextFound(CatSongs.SetFilter(Button[0].Text[0].Text, fSelectType)); @@ -110,9 +110,9 @@ begin SDLK_RETURN, SDLK_ESCAPE: begin - Visible := false; + Visible := False; AudioPlayback.PlaySound(SoundLib.Back); - if (fVisSongs = 0) and (Length(Button[0].Text[0].Text) > 0) then + if (fVisSongs = 0) AND (Length(Button[0].Text[0].Text) > 0) then begin ScreenSong.UnLoadDetailedCover; Button[0].Text[0].Text := ''; @@ -168,14 +168,15 @@ begin fSelectType := fltAll; AddSelectSlide(Theme.SongJumpto.SelectSlideType, PInteger(@fSelectType)^, Theme.SongJumpto.IType); + Interaction := 0; fLastPlayed := 0; end; -procedure TScreenSongJumpto.SetVisible(Value: boolean); +procedure TScreenSongJumpto.SetVisible(Value: Boolean); begin //If change from invisible to Visible then OnShow - if (fVisible = false) and (Value = true) then + if (fVisible = False) AND (Value = True) then OnShow; fVisible := Value; @@ -196,7 +197,7 @@ begin //Select Input Interaction := 0; - Button[0].Text[0].Selected := true; + Button[0].Text[0].Selected := True; fLastPlayed := ScreenSong.Interaction; end; @@ -206,7 +207,7 @@ begin Result := inherited Draw; end; -procedure TScreenSongJumpto.SetTextFound(const Count: cardinal); +procedure TScreenSongJumpto.SetTextFound(Count: Cardinal); begin if (Count = 0) then begin @@ -224,6 +225,7 @@ begin ScreenSong.ShowCatTLCustom(Format(Theme.SongJumpto.CatText, [Button[0].Text[0].Text])); end; + //Set visSongs fVisSongs := Count; diff --git a/unicode/src/screens/UScreenSongMenu.pas b/unicode/src/screens/UScreenSongMenu.pas index e09dd9b5..b8720b86 100644 --- a/unicode/src/screens/UScreenSongMenu.pas +++ b/unicode/src/screens/UScreenSongMenu.pas @@ -196,6 +196,7 @@ begin SetLength(ISelections, 1); ISelections[0] := 'Dummy'; + AddText(Theme.SongMenu.TextMenu); LoadFromTheme(Theme.SongMenu); @@ -401,16 +402,19 @@ begin begin CurMenu := sMenu; Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER'); - - Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0); + // to-do : Party +{ + Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0); Button[1].Visible := (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0); Button[2].Visible := (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0); +} Button[3].Visible := true; SelectsS[0].Visible := false; - - Button[0].Text[0].Text := string(PartySession.Teams.Teaminfo[0].Name); - Button[1].Text[0].Text := string(PartySession.Teams.Teaminfo[1].Name); - Button[2].Text[0].Text := string(PartySession.Teams.Teaminfo[2].Name); +{ + Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name); + Button[1].Text[0].Text := String(PartySession.Teams.Teaminfo[1].Name); + Button[2].Text[0].Text := String(PartySession.Teams.Teaminfo[2].Name); +} Button[3].Text[0].Text := Language.Translate('SONG_MENU_CANCEL'); // set right interaction @@ -421,10 +425,10 @@ begin if (not Button[2].Visible) then Interaction := 4 else - Interaction := 2; + Interaction := 2; end else - Interaction := 1; + Interaction := 1; end; end; diff --git a/unicode/src/screens/UScreenStatDetail.pas b/unicode/src/screens/UScreenStatDetail.pas index 5a0419b7..6241ee2e 100644 --- a/unicode/src/screens/UScreenStatDetail.pas +++ b/unicode/src/screens/UScreenStatDetail.pas @@ -47,20 +47,21 @@ type TScreenStatDetail = class(TMenu) public Typ: TStatType; - Page: cardinal; - Count: byte; - Reversed: boolean; + Page: Cardinal; + Count: Byte; + Reversed: Boolean; + + TotEntrys: Cardinal; + TotPages: Cardinal; - TotEntrys: cardinal; - TotPages: cardinal; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; procedure SetTitle; - Procedure SetPage(NewPage: cardinal); + Procedure SetPage(NewPage: Cardinal); end; implementation @@ -73,10 +74,10 @@ uses ULog, UUnicodeUtils; -function TScreenStatDetail.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenStatDetail.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -97,28 +98,24 @@ begin end; SDLK_RETURN: begin - if Interaction = 0 then - begin + if Interaction = 0 then begin //Next Page SetPage(Page+1); end; - if Interaction = 1 then - begin + if Interaction = 1 then begin //Previous Page if (Page > 0) then SetPage(Page-1); end; - if Interaction = 2 then - begin + if Interaction = 2 then begin //Reverse Order Reversed := not Reversed; SetPage(Page); end; - if Interaction = 3 then - begin + if Interaction = 3 then begin AudioPlayback.PlaySound(SoundLib.Back); FadeTo(@ScreenStatMain); end; @@ -191,7 +188,7 @@ begin SetTitle; //Show First Page - Reversed := false; + Reversed := False; SetPage(0); end; @@ -203,12 +200,12 @@ begin Text[Count].Text := Theme.StatDetail.Description[Ord(Typ)]; end; -procedure TScreenStatDetail.SetPage(NewPage: cardinal); +procedure TScreenStatDetail.SetPage(NewPage: Cardinal); var StatList: TList; - I: integer; - FormatStr: string; - PerPage: byte; + I: Integer; + FormatStr: String; + PerPage: Byte; begin // fetch statistics StatList := Database.GetStats(Typ, Count, NewPage, Reversed); @@ -292,9 +289,9 @@ begin Database.FreeStats(StatList); end; + procedure TScreenStatDetail.SetAnimationProgress(Progress: real); -var - I: integer; +var I: Integer; begin for I := 0 to High(Button) do Button[I].Texture.ScaleW := Progress; diff --git a/unicode/src/screens/UScreenStatMain.pas b/unicode/src/screens/UScreenStatMain.pas index 6d4d3f5b..a183f04c 100644 --- a/unicode/src/screens/UScreenStatMain.pas +++ b/unicode/src/screens/UScreenStatMain.pas @@ -46,14 +46,14 @@ type TScreenStatMain = class(TMenu) private //Some Stat Value that don't need to be calculated 2 times - SongsWithVid: cardinal; + SongsWithVid: Cardinal; function FormatOverviewIntro(FormatStr: string): string; function FormatSongOverview(FormatStr: string): string; function FormatPlayerOverview(FormatStr: string): string; public TextOverview: integer; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; procedure onShow; override; procedure SetAnimationProgress(Progress: real); override; @@ -73,10 +73,10 @@ uses ULog, UUnicodeUtils; -function TScreenStatMain.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenStatMain.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then + If (PressedDown) Then begin // Key Down // check normal keys case UCS4UpperCase(CharCode) of @@ -165,7 +165,7 @@ begin //Set Songs with Vid SongsWithVid := 0; - for I := 0 to Songs.SongList.Count -1 do + For I := 0 to Songs.SongList.Count -1 do if (TSong(Songs.SongList[I]).Video <> '') then Inc(SongsWithVid); end; @@ -180,7 +180,7 @@ end; function TScreenStatMain.FormatOverviewIntro(FormatStr: string): string; var - Year, Month, Day: word; + Year, Month, Day: Word; begin {Format: %0:d Ultrastar Version @@ -201,8 +201,8 @@ end; function TScreenStatMain.FormatSongOverview(FormatStr: string): string; var - CntSongs, CntSungSongs, CntVidSongs: integer; - MostPopSongArtist, MostPopSongTitle: string; + CntSongs, CntSungSongs, CntVidSongs: Integer; + MostPopSongArtist, MostPopSongTitle: String; StatList: TList; MostSungSong: TStatResultMostSungSong; begin @@ -217,7 +217,7 @@ begin CntSungSongs := Database.GetTotalEntrys(stMostSungSong); CntVidSongs := SongsWithVid; - StatList := Database.GetStats(stMostSungSong, 1, 0, false); + StatList := Database.GetStats(stMostSungSong, 1, 0, False); if ((StatList <> nil) and (StatList.Count > 0)) then begin MostSungSong := StatList[0]; @@ -245,11 +245,11 @@ end; function TScreenStatMain.FormatPlayerOverview(FormatStr: string): string; var - CntPlayers: integer; + CntPlayers: Integer; BestScoreStat: TStatResultBestScores; BestSingerStat: TStatResultBestSingers; - BestPlayer, BestScorePlayer: string; - BestPlayerScore, BestScore: integer; + BestPlayer, BestScorePlayer: String; + BestPlayerScore, BestScore: Integer; SingerStats, ScoreStats: TList; begin {Format: @@ -261,7 +261,7 @@ begin CntPlayers := Database.GetTotalEntrys(stBestSingers); - SingerStats := Database.GetStats(stBestSingers, 1, 0, false); + SingerStats := Database.GetStats(stBestSingers, 1, 0, False); if ((SingerStats <> nil) and (SingerStats.Count > 0)) then begin BestSingerStat := SingerStats[0]; @@ -275,7 +275,7 @@ begin end; Database.FreeStats(SingerStats); - ScoreStats := Database.GetStats(stBestScores, 1, 0, false); + ScoreStats := Database.GetStats(stBestScores, 1, 0, False); if ((ScoreStats <> nil) and (ScoreStats.Count > 0)) then begin BestScoreStat := ScoreStats[0]; @@ -303,7 +303,7 @@ end; procedure TScreenStatMain.SetOverview; var - Overview: string; + Overview: String; begin // Format overview Overview := FormatOverviewIntro(Language.Translate('STAT_OVERVIEW_INTRO')) + '\n \n' + @@ -312,11 +312,11 @@ begin Text[0].Text := Overview; end; + procedure TScreenStatMain.SetAnimationProgress(Progress: real); -var - I: integer; +var I: Integer; begin - for I := 0 to high(Button) do + For I := 0 to high(Button) do Button[I].Texture.ScaleW := Progress; end; diff --git a/unicode/src/screens/UScreenTop5.pas b/unicode/src/screens/UScreenTop5.pas index eeec8ed7..eaa90ab1 100644 --- a/unicode/src/screens/UScreenTop5.pas +++ b/unicode/src/screens/UScreenTop5.pas @@ -57,7 +57,6 @@ type constructor Create; override; function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; - function ParseMouse(MouseButton: integer; BtnDown: boolean; X, Y: integer): boolean; override; procedure onShow; override; function Draw: boolean; override; end; @@ -72,12 +71,10 @@ uses UNote, UUnicodeUtils; -function TScreenTop5.ParseInput(PressedKey: cardinal; - CharCode: UCS4Char; - PressedDown: boolean): boolean; +function TScreenTop5.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; begin Result := true; - if PressedDown then + if (PressedDown) then begin // check normal keys case UCS4UpperCase(CharCode) of @@ -95,7 +92,7 @@ begin SDLK_RETURN: begin if (not Fadeout) then - begin + begin FadeTo(@ScreenSong); Fadeout := true; end; @@ -108,16 +105,6 @@ begin end; end; -function TScreenTop5.ParseMouse(MouseButton: integer; - BtnDown: boolean; - X, Y: integer): boolean; -begin - Result := true; - if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then - //left-click anywhere sends return - ParseInput(SDLK_RETURN, 0, true); -end; - constructor TScreenTop5.Create; var I: integer; @@ -126,16 +113,19 @@ begin LoadFromTheme(Theme.Top5); - TextLevel := AddText(Theme.Top5.TextLevel); + + TextLevel := AddText(Theme.Top5.TextLevel); TextArtistTitle := AddText(Theme.Top5.TextArtistTitle); for I := 0 to 4 do - begin - StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]); - TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]); - TextName[I+1] := AddText (Theme.Top5.TextName[I]); - TextScore[I+1] := AddText (Theme.Top5.TextScore[I]); - end; + StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] ); + + for I := 0 to 4 do + TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]); + for I := 0 to 4 do + TextName[I+1] := AddText(Theme.Top5.TextName[I]); + for I := 0 to 4 do + TextScore[I+1] := AddText(Theme.Top5.TextScore[I]); end; @@ -172,7 +162,7 @@ begin Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score); end; - for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do + for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do begin Static[StaticNumber[I]].Visible := false; Text[TextNumber[I]].Visible := false; diff --git a/unicode/src/screens/UScreenWelcome.pas b/unicode/src/screens/UScreenWelcome.pas index b798629f..4df2b6f7 100644 --- a/unicode/src/screens/UScreenWelcome.pas +++ b/unicode/src/screens/UScreenWelcome.pas @@ -34,10 +34,7 @@ interface {$I switches.inc} uses - UMenu, - SDL, - SysUtils, - UThemes; + UMenu, SDL, SysUtils, UThemes; type TScreenWelcome = class(TMenu) @@ -45,29 +42,24 @@ type Animation: real; Fadeout: boolean; constructor Create; override; - function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override; + function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override; function Draw: boolean; override; procedure onShow; override; end; implementation -uses - UGraphic, - UTime, - USkins, - UTexture; +uses UGraphic, UTime, USkins, UTexture; -function TScreenWelcome.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; +function TScreenWelcome.ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; begin Result := true; - if (PressedDown) then - begin + If (PressedDown) Then begin case PressedKey of SDLK_ESCAPE, SDLK_BACKSPACE : begin - Result := false; + Result := False; end; SDLK_RETURN: begin @@ -110,14 +102,12 @@ begin // draw nothing Min := 0; Max := 1000; - if (Animation >= Min) and (Animation < Max) then - begin + if (Animation >= Min) and (Animation < Max) then begin end; // popup Min := 1000; Max := 1120; - if (Animation >= Min) and (Animation < Max) then - begin + if (Animation >= Min) and (Animation < Max) then begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.X := 600; Static[0].Texture.Y := 600 - Factor * 230; @@ -127,8 +117,7 @@ begin // bounce Min := 1120; Max := 1200; - if (Animation >= Min) and (Animation < Max) then - begin + if (Animation >= Min) and (Animation < Max) then begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.Y := 370 + Factor * 50; Static[0].Texture.H := 230 - Factor * 50; @@ -136,15 +125,14 @@ begin // run Min := 1500; Max := 3500; - if (Animation >= Min) and (Animation < Max) then - begin + if (Animation >= Min) and (Animation < Max) then begin Factor := (Animation - Min) / (Max - Min); Static[0].Texture.X := 600 - Factor * 1400; Static[0].Texture.H := 180; - for Count := 1 to 5 do - begin + + for Count := 1 to 5 do begin Static[Count].Texture.X := 770 - Factor * 1400; Static[Count].Texture.W := 150 + Factor * 200; Static[Count].Texture.Alpha := Factor * 0.5; @@ -152,8 +140,7 @@ begin end; Min := 3500; - if (Animation >= Min) and (not Fadeout) then - begin + if (Animation >= Min) and (not Fadeout) then begin FadeTo(@ScreenMain); Fadeout := true; end; diff --git a/unicode/src/ultrastardx.dpr b/unicode/src/ultrastardx.dpr index f6376365..9bcc4aca 100644 --- a/unicode/src/ultrastardx.dpr +++ b/unicode/src/ultrastardx.dpr @@ -203,7 +203,6 @@ uses USingNotes in 'base\USingNotes.pas', UPath in 'base\UPath.pas', UNote in 'base\UNote.pas', - UBeatTimer in 'base\UBeatTimer.pas', TextGL in 'base\TextGL.pas', UUnicodeUtils in 'base\UUnicodeUtils.pas', @@ -216,6 +215,22 @@ uses //------------------------------ //Includes - Plugin Support //------------------------------ + {UPluginDefines in 'pluginsupport\UPluginDefines.pas', + UPartyDefines in 'pluginsupport\UPartyDefines.pas', + + UPartyMode in 'pluginsupport\UPartyMode.pas', + UPartyManager in 'pluginsupport\UPartyManager.pas', + UPartyModePlugin in 'pluginsupport\UPartyModePlugin.pas', + UPluginLoader in 'pluginsupport\UPluginLoader.pas', } + + UModules in 'base\UModules.pas', //List of Modules to Load + UHooks in 'base\UHooks.pas', //Hook Managing + UServices in 'base\UServices.pas', //Service Managing + UCore in 'base\UCore.pas', //Core, Maybe remove this + UCoreModule in 'base\UCoreModule.pas', //^ + UPluginInterface in 'base\UPluginInterface.pas', //Interface offered by Core to Plugins + UPluginLoader in 'base\UPluginLoader.pas', //New Plugin Loader Module + UParty in 'base\UParty.pas', // TODO: rewrite Party Manager as Module, reomplent ability to offer party Mody by Plugin //------------------------------ @@ -239,7 +254,7 @@ uses UAudioPlaybackBase in 'media\UAudioPlaybackBase.pas', {$IF Defined(UsePortaudioPlayback) or Defined(UseSDLPlayback)} UFFT in 'lib\fft\UFFT.pas', - UAudioPlayback_SoftMixer in 'media\UAudioPlayback_SoftMixer.pas', + UAudioPlayback_Softmixer in 'media\UAudioPlayback_SoftMixer.pas', {$IFEND} UAudioConverter in 'media\UAudioConverter.pas', @@ -327,6 +342,8 @@ uses //Includes - Modi SDK //------------------------------ ModiSDK in '..\plugins\SDK\ModiSDK.pas', //Old SDK, will be deleted soon + UPluginDefs in '..\plugins\SDK\UPluginDefs.pas', //New SDK, not only Modis + UPartyDefs in '..\plugins\SDK\UPartyDefs.pas', //Headers to register Party Modes SysUtils; |