aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--unicode/src/base/UBeatTimer.pas170
-rw-r--r--unicode/src/base/UCommon.pas87
-rw-r--r--unicode/src/base/UConfig.pas2
-rw-r--r--unicode/src/base/UCore.pas550
-rw-r--r--unicode/src/base/UCoreModule.pas154
-rw-r--r--unicode/src/base/UDLLManager.pas194
-rw-r--r--unicode/src/base/UDraw.pas2
-rw-r--r--unicode/src/base/UEditorLyrics.pas12
-rw-r--r--unicode/src/base/UGraphic.pas34
-rw-r--r--unicode/src/base/UHooks.pas460
-rw-r--r--unicode/src/base/UImage.pas41
-rw-r--r--unicode/src/base/UIni.pas27
-rw-r--r--unicode/src/base/UMain.pas89
-rw-r--r--unicode/src/base/UModules.pas55
-rw-r--r--unicode/src/base/UMusic.pas134
-rw-r--r--unicode/src/base/UNote.pas2
-rw-r--r--unicode/src/base/UParty.pas594
-rw-r--r--unicode/src/base/UPlatform.pas24
-rw-r--r--unicode/src/base/UPluginInterface.pas186
-rw-r--r--unicode/src/base/UPluginLoader.pas794
-rw-r--r--unicode/src/base/URecord.pas10
-rw-r--r--unicode/src/base/UServices.pas384
-rw-r--r--unicode/src/base/USingScores.pas643
-rw-r--r--unicode/src/base/USongs.pas181
-rw-r--r--unicode/src/base/UTexture.pas4
-rw-r--r--unicode/src/base/UThemes.pas33
-rw-r--r--unicode/src/base/UTime.pas28
-rw-r--r--unicode/src/lib/ffmpeg/avcodec.pas1528
-rw-r--r--unicode/src/lib/ffmpeg/avformat.pas288
-rw-r--r--unicode/src/lib/ffmpeg/avio.pas43
-rw-r--r--unicode/src/lib/ffmpeg/avutil.pas183
-rw-r--r--unicode/src/lib/ffmpeg/mathematics.pas14
-rw-r--r--unicode/src/lib/ffmpeg/opt.pas16
-rw-r--r--unicode/src/lib/ffmpeg/rational.pas11
-rw-r--r--unicode/src/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt24
-rwxr-xr-xunicode/src/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh6
-rwxr-xr-xunicode/src/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh23
-rw-r--r--unicode/src/lib/ffmpeg/swscale.pas160
-rw-r--r--unicode/src/media/UAudioDecoder_FFmpeg.pas11
-rw-r--r--unicode/src/media/UAudioInput_Bass.pas2
-rw-r--r--unicode/src/media/UAudioInput_Portaudio.pas3
-rw-r--r--unicode/src/media/UAudioPlayback_SoftMixer.pas6
-rw-r--r--unicode/src/media/UVideo.pas6
-rw-r--r--unicode/src/menu/UDisplay.pas294
-rw-r--r--unicode/src/menu/UMenu.pas373
-rw-r--r--unicode/src/menu/UMenuBackgroundFade.pas20
-rw-r--r--unicode/src/menu/UMenuButton.pas74
-rw-r--r--unicode/src/menu/UMenuButtonCollection.pas32
-rw-r--r--unicode/src/menu/UMenuEqualizer.pas145
-rw-r--r--unicode/src/menu/UMenuInteract.pas4
-rw-r--r--unicode/src/menu/UMenuSelectSlide.pas272
-rw-r--r--unicode/src/menu/UMenuStatic.pas11
-rw-r--r--unicode/src/menu/UMenuText.pas173
-rw-r--r--unicode/src/screens/UScreenCredits.pas1262
-rw-r--r--unicode/src/screens/UScreenEditConvert.pas86
-rw-r--r--unicode/src/screens/UScreenEditHeader.pas6
-rw-r--r--unicode/src/screens/UScreenEditSub.pas100
-rw-r--r--unicode/src/screens/UScreenLevel.pas29
-rw-r--r--unicode/src/screens/UScreenLoading.pas14
-rw-r--r--unicode/src/screens/UScreenMain.pas44
-rw-r--r--unicode/src/screens/UScreenName.pas22
-rw-r--r--unicode/src/screens/UScreenOpen.pas10
-rw-r--r--unicode/src/screens/UScreenOptions.pas6
-rw-r--r--unicode/src/screens/UScreenOptionsAdvanced.pas32
-rw-r--r--unicode/src/screens/UScreenOptionsGame.pas33
-rw-r--r--unicode/src/screens/UScreenOptionsGraphics.pas44
-rw-r--r--unicode/src/screens/UScreenOptionsLyrics.pas25
-rw-r--r--unicode/src/screens/UScreenOptionsRecord.pas15
-rw-r--r--unicode/src/screens/UScreenOptionsSound.pas42
-rw-r--r--unicode/src/screens/UScreenOptionsThemes.pas15
-rw-r--r--unicode/src/screens/UScreenPartyNewRound.pas307
-rw-r--r--unicode/src/screens/UScreenPartyOptions.pas15
-rw-r--r--unicode/src/screens/UScreenPartyPlayer.pas94
-rw-r--r--unicode/src/screens/UScreenPartyScore.pas145
-rw-r--r--unicode/src/screens/UScreenPartyWin.pas135
-rw-r--r--unicode/src/screens/UScreenPopup.pas67
-rw-r--r--unicode/src/screens/UScreenScore.pas10
-rw-r--r--unicode/src/screens/UScreenSing.pas18
-rw-r--r--unicode/src/screens/UScreenSingModi.pas419
-rw-r--r--unicode/src/screens/UScreenSong.pas209
-rw-r--r--unicode/src/screens/UScreenSongJumpto.pas33
-rw-r--r--unicode/src/screens/UScreenSongMenu.pas20
-rw-r--r--unicode/src/screens/UScreenStatDetail.pas45
-rw-r--r--unicode/src/screens/UScreenStatMain.pas36
-rw-r--r--unicode/src/screens/UScreenTop5.pas34
-rw-r--r--unicode/src/screens/UScreenWelcome.pas39
-rw-r--r--unicode/src/ultrastardx.dpr21
87 files changed, 5506 insertions, 6542 deletions
diff --git a/unicode/src/base/UBeatTimer.pas b/unicode/src/base/UBeatTimer.pas
new file mode 100644
index 00000000..37d221e1
--- /dev/null
+++ b/unicode/src/base/UBeatTimer.pas
@@ -0,0 +1,170 @@
+ {* UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *}
+
+unit 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 f5697916..3230a065 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,20 +206,19 @@ 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;
@@ -244,7 +243,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
@@ -264,14 +263,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.
@@ -279,30 +278,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;
@@ -331,12 +330,10 @@ 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}
@@ -389,7 +386,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;
@@ -462,7 +459,7 @@ end;
procedure ShowMessage(const msg: String; msgType: TMessageType);
{$IFDEF MSWINDOWS}
-var Flags: Cardinal;
+var Flags: cardinal;
{$ENDIF}
begin
{$IF Defined(MSWINDOWS)}
@@ -488,7 +485,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
@@ -564,7 +561,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
@@ -580,9 +577,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
@@ -603,9 +600,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;
@@ -613,7 +610,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 cb663e2d..1214f36f 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/UCore.pas b/unicode/src/base/UCore.pas
deleted file mode 100644
index a7f9e56e..00000000
--- a/unicode/src/base/UCore.pas
+++ /dev/null
@@ -1,550 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit UCore;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- uPluginDefs,
- uCoreModule,
- UHooks,
- UServices,
- UModules;
-
-{*********************
- TCore
- Class manages all CoreModules, the StartUp, the MainLoop and the shutdown process
- Also, it does some error handling, and maybe sometime multithreaded loading ;)
-*********************}
-
-type
- TModuleListItem = record
- Module: TCoreModule; // Instance of the modules class
- Info: TModuleInfo; // ModuleInfo returned by modules modulinfo proc
- NeedsDeInit: boolean; // True if module was succesful inited
- end;
-
- TCore = class
- private
- // Some Hook Handles. See Plugin SDKs Hooks.txt for Infos
- hLoadingFinished: THandle;
- hMainLoop: THandle;
- hTranslate: THandle;
- hLoadTextures: THandle;
- hExitQuery: THandle;
- hExit: THandle;
- hDebug: THandle;
- hError: THandle;
- sReportError: THandle;
- sReportDebug: THandle;
- sShowMessage: THandle;
- sRetranslate: THandle;
- sReloadTextures: THandle;
- sGetModuleInfo: THandle;
- sGetApplicationHandle: THandle;
-
- Modules: array [0..High(CORE_MODULES_TO_LOAD)] of TModuleListItem;
-
- // Cur + Last Executed Setting and Getting ;)
- iCurExecuted: integer;
- iLastExecuted: integer;
-
- procedure SetCurExecuted(Value: integer);
-
- // Function Get all Modules and Creates them
- function GetModules: boolean;
-
- // Loads Core and all Modules
- function Load: boolean;
-
- // Inits Core and all Modules
- function Init: boolean;
-
- // DeInits Core and all Modules
- function DeInit: boolean;
-
- // Load the Core
- function LoadCore: boolean;
-
- // Init the Core
- function InitCore: boolean;
-
- // DeInit the Core
- function DeInitCore: boolean;
-
- // Called one time per frame
- function MainLoop: boolean;
-
- public
- Hooks: THookManager; // The Hook Manager ;)
- Services: TServiceManager; // The Service Manager
-
- Name: string; // Name of this application
- Version: LongWord; // Version of this ". For info look plugindefs functions
-
- LastErrorReporter: string; // Who reported the last error string
- LastErrorString: string; // Last error string reported
-
- property CurExecuted: integer read iCurExecuted write SetCurExecuted; //ID of plugin or module curently executed
- property LastExecuted: integer read iLastExecuted;
-
- //---------------
- // Main methods to control the core:
- //---------------
- constructor Create(const cName: string; const cVersion: LongWord);
-
- // Starts loading and init process. Then runs MainLoop. DeInits on shutdown
- procedure Run;
-
- // Method for other classes to get pointer to a specific module
- function GetModulebyName(const Name: string): PCoreModule;
-
- //--------------
- // Hook and service procs:
- //--------------
- function ShowMessage(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (lParam: PChar Text, wParam: Symbol)
- function ReportError(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername))
- function ReportDebug(wParam: TwParam; lParam: TlParam): integer; //Shows a Message (wParam: Pchar(Message), lParam: PChar(Reportername))
- function Retranslate(wParam: TwParam; lParam: TlParam): integer; //Calls Translate hook
- function ReloadTextures(wParam: TwParam; lParam: TlParam): integer; //Calls LoadTextures hook
- function GetModuleInfo(wParam: TwParam; lParam: TlParam): integer; //If lParam = nil then get length of Moduleinfo array. If lparam <> nil then write array of TModuleInfo to address at lparam
- function GetApplicationHandle(wParam: TwParam; lParam: TlParam): integer; //Returns Application Handle
- end;
-
-var
- Core: TCore;
-
-implementation
-
-uses
- {$IFDEF win32}
- Windows,
- {$ENDIF}
- SysUtils;
-
-//-------------
-// Create - Creates Class + Hook and Service Manager
-//-------------
-constructor TCore.Create(const cName: string; const cVersion: LongWord);
-begin
- inherited Create;
-
- Name := cName;
- Version := cVersion;
- iLastExecuted := 0;
- iCurExecuted := 0;
-
- LastErrorReporter := '';
- LastErrorString := '';
-
- Hooks := THookManager.Create(50);
- Services := TServiceManager.Create;
-end;
-
-//-------------
-// Starts Loading and Init process. Then runs MainLoop. DeInits on shutdown
-//-------------
-procedure TCore.Run;
-var
- Success: boolean;
-
- procedure HandleError(const ErrorMsg: string);
- begin
- if (LastErrorString <> '') then
- Self.ShowMessage(CORE_SM_ERROR, PChar(ErrorMsg + ': ' + LastErrorString))
- else
- Self.ShowMessage(CORE_SM_ERROR, PChar(ErrorMsg));
-
- // DeInit
- DeInit;
- end;
-
-begin
- // Get modules
- try
- Success := GetModules();
- except
- Success := false;
- end;
-
- if (not Success) then
- begin
- HandleError('Error Getting Modules');
- Exit;
- end;
-
- // Loading
- try
- Success := Load();
- except
- Success := false;
- end;
-
- if (not Success) then
- begin
- HandleError('Error loading Modules');
- Exit;
- end;
-
- // Init
- try
- Success := Init();
- except
- Success := false;
- end;
-
- if (not Success) then
- begin
- HandleError('Error initing Modules');
- Exit;
- end;
-
- // Call Translate Hook
- if (Hooks.CallEventChain(hTranslate, 0, nil) <> 0) then
- begin
- HandleError('Error translating');
- Exit;
- end;
-
- // Calls LoadTextures Hook
- if (Hooks.CallEventChain(hLoadTextures, 0, nil) <> 0) then
- begin
- HandleError('Error loading textures');
- Exit;
- end;
-
- // Calls Loading Finished Hook
- if (Hooks.CallEventChain(hLoadingFinished, 0, nil) <> 0) then
- begin
- HandleError('Error calling LoadingFinished Hook');
- Exit;
- end;
-
- // Start MainLoop
- while Success do
- begin
- Success := MainLoop();
- // to-do : Call Display Draw here
- end;
-end;
-
-//-------------
-// Called one time per frame
-//-------------
-function TCore.MainLoop: boolean;
-begin
- Result := false;
-end;
-
-//-------------
-// Function get all modules and creates them
-//-------------
-function TCore.GetModules: boolean;
-var
- i: integer;
-begin
- Result := false;
- for i := 0 to high(Modules) do
- begin
- try
- Modules[i].NeedsDeInit := false;
- Modules[i].Module := CORE_MODULES_TO_LOAD[i].Create;
- Modules[i].Module.Info(@Modules[i].Info);
- except
- ReportError(integer(PChar('Can''t get module #' + InttoStr(i) + ' "' + Modules[i].Info.Name + '"')), PChar('Core'));
- Exit;
- end;
- end;
- Result := true;
-end;
-
-//-------------
-// Loads core and all modules
-//-------------
-function TCore.Load: boolean;
-var
- i: integer;
-begin
- Result := LoadCore;
-
- for i := 0 to High(CORE_MODULES_TO_LOAD) do
- begin
- try
- Result := Modules[i].Module.Load;
- except
- Result := false;
- end;
-
- if (not Result) then
- begin
- ReportError(integer(PChar('Error loading module #' + InttoStr(i) + ' "' + Modules[i].Info.Name + '"')), PChar('Core'));
- break;
- end;
- end;
-end;
-
-//-------------
-// Inits core and all modules
-//-------------
-function TCore.Init: boolean;
-var
- i: integer;
-begin
- Result := InitCore;
-
- for i := 0 to High(CORE_MODULES_TO_LOAD) do
- begin
- try
- Result := Modules[i].Module.Init;
- except
- Result := false;
- end;
-
- if (not Result) then
- begin
- ReportError(integer(PChar('Error initing module #' + InttoStr(i) + ' "' + Modules[i].Info.Name + '"')), PChar('Core'));
- break;
- end;
-
- Modules[i].NeedsDeInit := Result;
- end;
-end;
-
-//-------------
-// DeInits core and all modules
-//-------------
-function TCore.DeInit: boolean;
-var
- i: integer;
-begin
-
- for i := High(CORE_MODULES_TO_LOAD) downto 0 do
- begin
- try
- if (Modules[i].NeedsDeInit) then
- Modules[i].Module.DeInit;
- except
- end;
- end;
-
- DeInitCore;
-
- Result := true;
-end;
-
-//-------------
-// Load the Core
-//-------------
-function TCore.LoadCore: boolean;
-begin
- hLoadingFinished := Hooks.AddEvent('Core/LoadingFinished');
- hMainLoop := Hooks.AddEvent('Core/MainLoop');
- hTranslate := Hooks.AddEvent('Core/Translate');
- hLoadTextures := Hooks.AddEvent('Core/LoadTextures');
- hExitQuery := Hooks.AddEvent('Core/ExitQuery');
- hExit := Hooks.AddEvent('Core/Exit');
- hDebug := Hooks.AddEvent('Core/NewDebugInfo');
- hError := Hooks.AddEvent('Core/NewError');
-
- sReportError := Services.AddService('Core/ReportError', nil, Self.ReportError);
- sReportDebug := Services.AddService('Core/ReportDebug', nil, Self.ReportDebug);
- sShowMessage := Services.AddService('Core/ShowMessage', nil, Self.ShowMessage);
- sRetranslate := Services.AddService('Core/Retranslate', nil, Self.Retranslate);
- sReloadTextures := Services.AddService('Core/ReloadTextures', nil, Self.ReloadTextures);
- sGetModuleInfo := Services.AddService('Core/GetModuleInfo', nil, Self.GetModuleInfo);
- sGetApplicationHandle := Services.AddService('Core/GetApplicationHandle', nil, Self.GetApplicationHandle);
-
- // A little Test
- Hooks.AddSubscriber('Core/NewError', HookTest);
-
- result := true;
-end;
-
-//-------------
-// Init the Core
-//-------------
-function TCore.InitCore: boolean;
-begin
- //Don not init something atm.
- result := true;
-end;
-
-//-------------
-// DeInit the Core
-//-------------
-function TCore.DeInitCore: boolean;
-begin
- // TODO: write TService-/HookManager. Free and call it here
- Result := true;
-end;
-
-//-------------
-// Method for other classes to get pointer to a specific module
-//-------------
-function TCore.GetModuleByName(const Name: string): PCoreModule;
-var i: integer;
-begin
- Result := nil;
- for i := 0 to High(Modules) do
- begin
- if (Modules[i].Info.Name = Name) then
- begin
- Result := @Modules[i].Module;
- Break;
- end;
- end;
-end;
-
-//-------------
-// Shows a MessageDialog (lParam: PChar Text, wParam: Symbol)
-//-------------
-function TCore.ShowMessage(wParam: TwParam; lParam: TlParam): integer;
-{$IFDEF MSWINDOWS}
-var Params: Cardinal;
-{$ENDIF}
-begin
- Result := -1;
-
- {$IFDEF MSWINDOWS}
- if (lParam <> nil) then
- begin
- Params := MB_OK;
- case wParam of
- CORE_SM_ERROR: Params := Params or MB_ICONERROR;
- CORE_SM_WARNING: Params := Params or MB_ICONWARNING;
- CORE_SM_INFO: Params := Params or MB_ICONINFORMATION;
- end;
-
- // Show:
- Result := Messagebox(0, lParam, PChar(Name), Params);
- end;
- {$ENDIF}
-
- // TODO: write ShowMessage for other OSes
-end;
-
-//-------------
-// Calls NewError HookChain (wParam: Pchar(Message), lParam: PChar(Reportername))
-//-------------
-function TCore.ReportError(wParam: TwParam; lParam: TlParam): integer;
-begin
- //Update LastErrorReporter and LastErrorString
- LastErrorReporter := string(PChar(lParam));
- LastErrorString := string(PChar(Pointer(wParam)));
-
- Hooks.CallEventChain(hError, wParam, lParam);
-
- // FIXME: return a correct result
- Result := 0;
-end;
-
-//-------------
-// Calls NewDebugInfo HookChain (wParam: Pchar(Message), lParam: PChar(Reportername))
-//-------------
-function TCore.ReportDebug(wParam: TwParam; lParam: TlParam): integer;
-begin
- Hooks.CallEventChain(hDebug, wParam, lParam);
-
- // FIXME: return a correct result
- Result := 0;
-end;
-
-//-------------
-// Calls Translate hook
-//-------------
-function TCore.Retranslate(wParam: TwParam; lParam: TlParam): integer;
-begin
- Hooks.CallEventChain(hTranslate, 1, nil);
-
- // FIXME: return a correct result
- Result := 0;
-end;
-
-//-------------
-// Calls LoadTextures hook
-//-------------
-function TCore.ReloadTextures(wParam: TwParam; lParam: TlParam): integer;
-begin
- Hooks.CallEventChain(hLoadTextures, 1, nil);
-
- // FIXME: return a correct result
- Result := 0;
-end;
-
-//-------------
-// If lParam = nil then get length of Moduleinfo array. If lparam <> nil then write array of TModuleInfo to address at lparam
-//-------------
-function TCore.GetModuleInfo(wParam: TwParam; lParam: TlParam): integer;
-var
- I: integer;
-begin
- if (Pointer(lParam) = nil) then
- begin
- Result := Length(Modules);
- end
- else
- begin
- try
- for I := 0 to High(Modules) do
- begin
- AModuleInfo(Pointer(lParam))[I].Name := Modules[I].Info.Name;
- AModuleInfo(Pointer(lParam))[I].Version := Modules[I].Info.Version;
- AModuleInfo(Pointer(lParam))[I].Description := Modules[I].Info.Description;
- end;
- Result := Length(Modules);
- except
- Result := -1;
- end;
- end;
-end;
-
-//-------------
-// Returns Application Handle
-//-------------
-function TCore.GetApplicationHandle(wParam: TwParam; lParam: TlParam): integer;
-begin
- Result := hInstance;
-end;
-
-//-------------
-// Called when setting CurExecuted
-//-------------
-procedure TCore.SetCurExecuted(Value: integer);
-begin
- // Set Last Executed
- iLastExecuted := iCurExecuted;
-
- // Set Cur Executed
- iCurExecuted := Value;
-end;
-
-end.
diff --git a/unicode/src/base/UCoreModule.pas b/unicode/src/base/UCoreModule.pas
deleted file mode 100644
index b87fec85..00000000
--- a/unicode/src/base/UCoreModule.pas
+++ /dev/null
@@ -1,154 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit UCoreModule;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-{*********************
- TCoreModule
- Dummy class that has methods that will be called from core
- In the best case every piece of this software is a module
-*********************}
-uses
- UPluginDefs;
-
-type
- PCoreModule = ^TCoreModule;
- TCoreModule = class
- public
- Constructor Create; virtual;
-
- //Function that gives some Infos about the Module to the Core
- Procedure Info(const pInfo: PModuleInfo); virtual;
-
- //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 Load: Boolean; virtual;
-
- //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 Init: Boolean; virtual;
-
- //Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing
- //If False is Returned this will cause a Forced Exit
- Function MainLoop: Boolean; virtual;
-
- //Is Called if this Module has been Inited and there is a Exit.
- //Deinit is in backwards Initing Order
- //If False is Returned this will cause a Forced Exit
- Procedure DeInit; virtual;
-
- //Is Called if this Module will be unloaded and has been created
- //Should be used to Free Memory
- Destructor Destroy; override;
- end;
- cCoreModule = class of TCoreModule;
-
-implementation
-
-//-------------
-// Just the Constructor
-//-------------
-Constructor TCoreModule.Create;
-begin
- //Dummy maaaan ;)
- inherited;
-end;
-
-//-------------
-// Function that gives some Infos about the Module to the Core
-//-------------
-Procedure TCoreModule.Info(const pInfo: PModuleInfo);
-begin
- pInfo^.Name := 'Not Set';
- pInfo^.Version := 0;
- pInfo^.Description := 'Not Set';
-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 TCoreModule.Load: Boolean;
-begin
- //Dummy ftw!!
- Result := True;
-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 TCoreModule.Init: Boolean;
-begin
- //Dummy ftw!!
- Result := True;
-end;
-
-//-------------
-//Is Called during Mainloop before 'Core/MainLoop' Hook and Drawing
-//If False is Returned this will cause a Forced Exit
-//-------------
-Function TCoreModule.MainLoop: Boolean;
-begin
- //Dummy ftw!!
- Result := True;
-end;
-
-//-------------
-//Is Called if this Module has been Inited and there is a Exit.
-//Deinit is in backwards Initing Order
-//-------------
-Procedure TCoreModule.DeInit;
-begin
- //Dummy ftw!!
-end;
-
-//-------------
-//Is Called if this Module will be unloaded and has been created
-//Should be used to Free Memory
-//-------------
-Destructor TCoreModule.Destroy;
-begin
- //Dummy ftw!!
- inherited;
-end;
-
-end.
diff --git a/unicode/src/base/UDLLManager.pas b/unicode/src/base/UDLLManager.pas
index cd4b7991..3faa15bf 100644
--- a/unicode/src/base/UDLLManager.pas
+++ b/unicode/src/base/UDLLManager.pas
@@ -40,37 +40,42 @@ 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)}
@@ -87,6 +92,7 @@ uses
{$ELSE}
dynlibs,
{$ENDIF}
+ UPath,
ULog,
SysUtils;
@@ -101,33 +107,33 @@ end;
procedure TDLLMan.GetPluginList;
var
- SR: TSearchRec;
+ SearchRecord: TSearchRec;
begin
- if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then
+ if FindFirst(PluginPath + '*' + DLLExt, faAnyFile, SearchRecord) = 0 then
begin
repeat
SetLength(Plugins, Length(Plugins)+1);
SetLength(PluginPaths, Length(Plugins));
- if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful
+ if LoadPluginInfo(SearchRecord.Name, High(Plugins)) then // loaded succesful
begin
- PluginPaths[High(PluginPaths)] := SR.Name;
+ PluginPaths[High(PluginPaths)] := SearchRecord.Name;
end
- else //Error Loading
+ else // error loading
begin
SetLength(Plugins, Length(Plugins)-1);
SetLength(PluginPaths, Length(Plugins));
end;
- until FindNext(SR) <> 0;
- FindClose(SR);
+ until FindNext(SearchRecord) <> 0;
+ FindClose(SearchRecord);
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';
@@ -136,109 +142,117 @@ begin
Plugins[No].Creator := 'Nobody';
Plugins[No].PluginDesc := 'NO_PLUGIN_DESC';
- 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].LoadSong := true;
+ Plugins[No].ShowScore := true;
+ Plugins[No].ShowBars := true;
+ Plugins[No].ShowNotes := true;
+ Plugins[No].LoadVideo := true;
+ Plugins[No].LoadBack := true;
- Plugins[No].TeamModeOnly := False;
- Plugins[No].GetSoundData := False;
- Plugins[No].Dummy := False;
+ Plugins[No].TeamModeOnly := true;
+ Plugins[No].GetSoundData := true;
+ Plugins[No].Dummy := true;
- Plugins[No].BGShowFull := False;
- Plugins[No].BGShowFull_O := True;
+ Plugins[No].BGShowFull := true;
+ Plugins[No].BGShowFull_O := true;
- Plugins[No].ShowRateBar:= False;
- Plugins[No].ShowRateBar_O := True;
+ Plugins[No].ShowRateBar := true;
+ Plugins[No].ShowRateBar_O := true;
- Plugins[No].EnLineBonus := False;
- Plugins[No].EnLineBonus_O := True;
+ Plugins[No].EnLineBonus := true;
+ 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 := False;
- //Clear Plugin Info
+ Result := true;
+// 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(DLLPath +PathDelim+ Filename));
- //If Loaded
+// load libary
+ hLibg := LoadLibrary(PChar(PluginPath + 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 := False;
- //Load Libary
- hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No]));
- //If Loaded
+ Result := true;
+// load libary
+ hLib := LoadLibrary(PChar(PluginPath + PluginPaths[No]));
+// if loaded
if (hLib <> 0) then
begin
- //Load Info Procedure
- @P_Init := GetProcAddress (hLib, PChar('Init'));
- @P_Draw := GetProcAddress (hLib, PChar('Draw'));
- @P_Finish := GetProcAddress (hLib, PChar('Finish'));
+// load info procedure
+ @P_Init := GetProcAddress (hLib, 'Init');
+ @P_Draw := GetProcAddress (hLib, 'Draw');
+ @P_Finish := GetProcAddress (hLib, '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
@@ -250,26 +264,26 @@ begin
if (@P_Init <> nil) then
Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods)
else
- Result := False
+ Result := true
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 := False
+ if (@P_Draw <> nil) then
+ Result := P_Draw (PlayerInfo, CurSentence)
+ else
+ Result := true
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 8a66d271..1783986f 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 := Skin_LyricsT + 3;
+ Bounds.Top := Theme.LyricBar.IndicatorYOffset + Theme.LyricBar.UpperY ;
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 fe8c3ee5..ef9d8dd6 100644
--- a/unicode/src/base/UEditorLyrics.pas
+++ b/unicode/src/base/UEditorLyrics.pas
@@ -40,7 +40,7 @@ uses
UTexture;
type
- alignment = (left, center, right);
+ TAlignmentType = (atLeft, atCenter, atRight);
TWord = record
X: real;
@@ -58,7 +58,7 @@ type
TEditorLyrics = class
private
- AlignI: alignment;
+ AlignI: TAlignmentType;
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: alignment);
+ procedure SetAlign(Value: TAlignmentType);
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: alignment write SetAlign;
+ property Align: TAlignmentType 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: alignment);
+procedure TEditorLyrics.SetAlign(Value: TAlignmentType);
begin
AlignI := Value;
end;
@@ -229,7 +229,7 @@ var
WordIndex: integer;
TotalWidth: real;
begin
- if AlignI = center then
+ if AlignI = atCenter 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 17175d02..818e49aa 100644
--- a/unicode/src/base/UGraphic.pas
+++ b/unicode/src/base/UGraphic.pas
@@ -198,7 +198,14 @@ 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;
@@ -232,17 +239,6 @@ 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;
@@ -339,6 +335,15 @@ 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'));
@@ -497,6 +502,7 @@ begin
Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D');
Display := TDisplay.Create;
+ //Display.SetCursor;
//Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2);
@@ -629,15 +635,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/UHooks.pas b/unicode/src/base/UHooks.pas
deleted file mode 100644
index acf2bba7..00000000
--- a/unicode/src/base/UHooks.pas
+++ /dev/null
@@ -1,460 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit UHooks;
-
-{*********************
- THookManager
- Class for saving, managing and calling of hooks.
- Saves all hookable events and their subscribers
-*********************}
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- uPluginDefs,
- SysUtils;
-
-type
- //Record that saves info from Subscriber
- PSubscriberInfo = ^TSubscriberInfo;
- TSubscriberInfo = record
- Self: THandle; // ID of this Subscription (First word: ID of Subscription; 2nd word: ID of Hook)
- Next: PSubscriberInfo; // Pointer to next Item in HookChain
-
- Owner: integer; //For Error Handling and Plugin Unloading.
-
- // Here is s/t tricky
- // To avoid writing of Wrapping Functions to Hook an Event with a Class
- // We save a Normal Proc or a Method of a Class
- case isClass: boolean of
- false: (Proc: TUS_Hook); //Proc that will be called on Event
- true: (ProcOfClass: TUS_Hook_of_Object);
- end;
-
- TEventInfo = record
- Name: string[60]; // Name of Event
- FirstSubscriber: PSubscriberInfo; // First subscriber in chain
- LastSubscriber: PSubscriberInfo; // Last " (for easier subscriber adding)
- end;
-
- THookManager = class
- private
- Events: array of TEventInfo;
- SpaceinEvents: word; //Number of empty Items in Events Array. (e.g. Deleted Items)
-
- procedure FreeSubscriber(const EventIndex: word; const Last, Cur: PSubscriberInfo);
- public
- constructor Create(const SpacetoAllocate: word);
-
- function AddEvent (const EventName: Pchar): THandle;
- function DelEvent (hEvent: THandle): integer;
-
- function AddSubscriber (const EventName: Pchar; const Proc: TUS_Hook = nil; const ProcOfClass: TUS_Hook_of_Object = nil): THandle;
- function DelSubscriber (const hSubscriber: THandle): integer;
-
- function CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): integer;
- function EventExists (const EventName: Pchar): integer;
-
- procedure DelbyOwner(const Owner: integer);
- end;
-
-function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall;
-
-var
- HookManager: THookManager;
-
-implementation
-
-uses
- ULog,
- UCore;
-
-//------------
-// Create - Creates Class and Set Standard Values
-//------------
-constructor THookManager.Create(const SpacetoAllocate: word);
-var
- I: integer;
-begin
- inherited Create();
-
- //Get the Space and "Zero" it
- SetLength (Events, SpacetoAllocate);
- for I := 0 to SpacetoAllocate-1 do
- Events[I].Name[1] := chr(0);
-
- SpaceinEvents := SpacetoAllocate;
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Succesful Created.');
- {$ENDIF}
-end;
-
-//------------
-// AddEvent - Adds an Event and return the Events Handle or 0 on Failure
-//------------
-function THookManager.AddEvent (const EventName: Pchar): THandle;
-var
- I: integer;
-begin
- Result := 0;
-
- if (EventExists(EventName) = 0) then
- begin
- if (SpaceinEvents > 0) then
- begin
- //There is already Space available
- //Go Search it!
- for I := 0 to High(Events) do
- if (Events[I].Name[1] = chr(0)) then
- begin //Found Space
- Result := I;
- Dec(SpaceinEvents);
- Break;
- end;
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Found Space for Event at Handle: ''' + InttoStr(Result+1) + '');
- {$ENDIF}
- end
- else
- begin //There is no Space => Go make some!
- Result := Length(Events);
- SetLength(Events, Result + 1);
- end;
-
- //Set Events Data
- Events[Result].Name := EventName;
- Events[Result].FirstSubscriber := nil;
- Events[Result].LastSubscriber := nil;
-
- //Handle is Index + 1
- Inc(Result);
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Add Event succesful: ''' + EventName + '');
- {$ENDIF}
- end
- {$IFDEF DEBUG}
- else
- debugWriteLn('HookManager: Trying to ReAdd Event: ''' + EventName + '');
- {$ENDIF}
-end;
-
-//------------
-// DelEvent - Deletes an Event by Handle Returns False on Failure
-//------------
-function THookManager.DelEvent (hEvent: THandle): integer;
-var
- Cur, Last: PSubscriberInfo;
-begin
- hEvent := hEvent - 1; //Arrayindex is Handle - 1
- Result := -1;
-
- if (Length(Events) > hEvent) and (Events[hEvent].Name[1] <> chr(0)) then
- begin //Event exists
- //Free the Space for all Subscribers
- Cur := Events[hEvent].FirstSubscriber;
-
- while (Cur <> nil) do
- begin
- Last := Cur;
- Cur := Cur.Next;
- FreeMem(Last, SizeOf(TSubscriberInfo));
- end;
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Removed Event succesful: ''' + Events[hEvent].Name + '');
- {$ENDIF}
-
- //Free the Event
- Events[hEvent].Name[1] := chr(0);
- Inc(SpaceinEvents); //There is one more space for new events
- end
-
- {$IFDEF DEBUG}
- else
- debugWriteLn('HookManager: Try to Remove not Existing Event. Handle: ''' + InttoStr(hEvent) + '');
- {$ENDIF}
-end;
-
-//------------
-// AddSubscriber - Adds an Subscriber to the Event by Name
-// Returns Handle of the Subscribtion or 0 on Failure
-//------------
-function THookManager.AddSubscriber (const EventName: Pchar; const Proc: TUS_Hook; const ProcOfClass: TUS_Hook_of_Object): THandle;
-var
- EventHandle: THandle;
- EventIndex: integer;
- Cur: PSubscriberInfo;
-begin
- Result := 0;
-
- if (@Proc <> nil) or (@ProcOfClass <> nil) then
- begin
- EventHandle := EventExists(EventName);
-
- if (EventHandle <> 0) then
- begin
- EventIndex := EventHandle - 1;
-
- //Get Memory
- GetMem(Cur, SizeOf(TSubscriberInfo));
-
- //Fill it with Data
- Cur.Next := nil;
-
- //Add Owner
- Cur.Owner := Core.CurExecuted;
-
- if (@Proc = nil) then
- begin //Use the ProcofClass Method
- Cur.isClass := true;
- Cur.ProcOfClass := ProcofClass;
- end
- else //Use the normal Proc
- begin
- Cur.isClass := false;
- Cur.Proc := Proc;
- end;
-
- //Create Handle (1st word: Handle of Event; 2nd word: unique ID
- if (Events[EventIndex].LastSubscriber = nil) then
- begin
- if (Events[EventIndex].FirstSubscriber = nil) then
- begin
- Result := (EventHandle SHL 16);
- Events[EventIndex].FirstSubscriber := Cur;
- end
- else
- begin
- Result := Events[EventIndex].FirstSubscriber.Self + 1;
- end;
- end
- else
- begin
- Result := Events[EventIndex].LastSubscriber.Self + 1;
- Events[EventIndex].LastSubscriber.Next := Cur;
- end;
-
- Cur.Self := Result;
-
- //Add to Chain
- Events[EventIndex].LastSubscriber := Cur;
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Add Subscriber to Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(Result) + ''' Owner: ' + InttoStr(Cur.Owner));
- {$ENDIF}
- end;
- end;
-end;
-
-//------------
-// FreeSubscriber - Helper for DelSubscriber. Prevents Loss of Chain Items. Frees Memory.
-//------------
-procedure THookManager.FreeSubscriber(const EventIndex: word; const Last, Cur: PSubscriberInfo);
-begin
- //Delete from Chain
- if (Last <> nil) then
- begin
- Last.Next := Cur.Next;
- end
- else //Was first Popup
- begin
- Events[EventIndex].FirstSubscriber := Cur.Next;
- end;
-
- //Was this Last subscription ?
- if (Cur = Events[EventIndex].LastSubscriber) then
- begin //Change Last Subscriber
- Events[EventIndex].LastSubscriber := Last;
- end;
-
- //Free Space:
- FreeMem(Cur, SizeOf(TSubscriberInfo));
-end;
-
-//------------
-// DelSubscriber - Deletes a Subscribtion by Handle, return non Zero on Failure
-//------------
-function THookManager.DelSubscriber (const hSubscriber: THandle): integer;
-var
- EventIndex: integer;
- Cur, Last: PSubscriberInfo;
-begin
- Result := -1;
- EventIndex := ((hSubscriber and (High(THandle) xor High(word))) SHR 16) - 1;
-
- //Existing Event ?
- if (EventIndex < Length(Events)) and (Events[EventIndex].Name[1] <> chr(0)) then
- begin
- Result := -2; //Return -1 on not existing Event, -2 on not existing Subscription
-
- //Search for Subscription
- Cur := Events[EventIndex].FirstSubscriber;
- Last := nil;
-
- //go through the chain ...
- while (Cur <> nil) do
- begin
- if (Cur.Self = hSubscriber) then
- begin //Found Subscription we searched for
- FreeSubscriber(EventIndex, Last, Cur);
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Del Subscriber from Event ''' + Events[EventIndex].Name + ''' succesful. Handle: ''' + InttoStr(hSubscriber) + '');
- {$ENDIF}
-
- //Set Result and Break the Loop
- Result := 0;
- Break;
- end;
-
- Last := Cur;
- Cur := Cur.Next;
- end;
-
- end;
-end;
-
-//------------
-// CallEventChain - Calls the Chain of a specified EventHandle
-// Returns: -1: Handle doesn't Exist, 0 Chain is called until the End
-//------------
-function THookManager.CallEventChain (const hEvent: THandle; const wParam: TwParam; lParam: TlParam): integer;
-var
- EventIndex: integer;
- Cur: PSubscriberInfo;
- CurExecutedBackup: integer; // backup of Core.CurExecuted Attribute
-begin
- Result := -1;
- EventIndex := hEvent - 1;
-
- if ((EventIndex <= High(Events)) and (Events[EventIndex].Name[1] <> chr(0))) then
- begin //Existing Event
- //Backup CurExecuted
- CurExecutedBackup := Core.CurExecuted;
-
- //Start calling the Chain !!!11
- Cur := Events[EventIndex].FirstSubscriber;
- Result := 0;
- //Call Hooks until the Chain is at the End or breaked
- while ((Cur <> nil) and (Result = 0)) do
- begin
- //Set CurExecuted
- Core.CurExecuted := Cur.Owner;
- if (Cur.isClass) then
- Result := Cur.ProcOfClass(wParam, lParam)
- else
- Result := Cur.Proc(wParam, lParam);
-
- Cur := Cur.Next;
- end;
-
- //Restore CurExecuted
- Core.CurExecuted := CurExecutedBackup;
- end;
-
- {$IFDEF DEBUG}
- debugWriteLn('HookManager: Called Chain from Event ''' + Events[EventIndex].Name + ''' succesful. Result: ''' + InttoStr(Result) + '');
- {$ENDIF}
-end;
-
-//------------
-// EventExists - Returns non Zero if an Event with the given Name exists
-//------------
-function THookManager.EventExists (const EventName: Pchar): integer;
-var
- I: integer;
- Name: string[60];
-begin
- Result := 0;
- //if (Length(EventName) <
- Name := string(EventName);
-
- //Sure not to search for empty space
- if (Name[1] <> chr(0)) then
- begin
- //Search for Event
- for I := 0 to High(Events) do
- if (Events[I].Name = Name) then
- begin //Event found
- Result := I + 1;
- Break;
- end;
- end;
-end;
-
-//------------
-// DelbyOwner - Dels all Subscriptions by a specific Owner. (For Clean Plugin/Module unloading)
-//------------
-procedure THookManager.DelbyOwner(const Owner: integer);
-var
- I: integer;
- Cur, Last: PSubscriberInfo;
-begin
- //Search for Owner in all Hooks Chains
- for I := 0 to High(Events) do
- begin
- if (Events[I].Name[1] <> chr(0)) then
- begin
-
- Last := nil;
- Cur := Events[I].FirstSubscriber;
- //Went Through Chain
- while (Cur <> nil) do
- begin
- if (Cur.Owner = Owner) then
- begin //Found Subscription by Owner -> Delete
- FreeSubscriber(I, Last, Cur);
- if (Last <> nil) then
- Cur := Last.Next
- else
- Cur := Events[I].FirstSubscriber;
- end
- else
- begin
- //Next Item:
- Last := Cur;
- Cur := Cur.Next;
- end;
- end;
- end;
- end;
-end;
-
-function HookTest(wParam: TwParam; lParam: TlParam): integer; stdcall;
-begin
- Result := 0; //Don't break the chain
- Core.ShowMessage(CORE_SM_INFO, Pchar(string(Pchar(Pointer(lParam))) + ': ' + string(Pchar(Pointer(wParam)))));
-end;
-
-end.
diff --git a/unicode/src/base/UImage.pas b/unicode/src/base/UImage.pas
index 8dc38495..60b0a3a2 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 := year;
- pngTime.month := month;
- pngTime.day := day;
+ pngTime.year := png_uint_16(year);
+ pngTime.month := png_byte(month);
+ pngTime.day := png_byte(day);
DecodeTime(time, hour, minute, second, msecond);
- pngTime.hour := hour;
- pngTime.minute := minute;
- pngTime.second := second;
+ pngTime.hour := png_byte(hour);
+ pngTime.minute := png_byte(minute);
+ pngTime.second := png_byte(second);
end;
(*
@@ -896,8 +896,13 @@ 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;
@@ -919,7 +924,8 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
if Blue > Max then Max := Blue;
// calc hue
- Delta := Max - Min;
+ 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.
if (Delta = 0) then
Result := 0
else
@@ -1023,16 +1029,19 @@ begin
end
else // all colors except black and white
begin
- Delta := Max - Min;
+ 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.
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)
@@ -1043,13 +1052,13 @@ begin
end;
{$IFDEF FPC_BIG_ENDIAN}
- PixelColors[3] := Red;
- PixelColors[2] := Green;
- PixelColors[1] := Blue
+ PixelColors[3] := byte(Red);
+ PixelColors[2] := byte(Green);
+ PixelColors[1] := byte(Blue);
{$ELSE}
- PixelColors[0] := Red;
- PixelColors[1] := Green;
- PixelColors[2] := Blue;
+ PixelColors[0] := byte(Red);
+ PixelColors[1] := byte(Green);
+ PixelColors[2] := byte(Blue);
{$ENDIF}
end;
diff --git a/unicode/src/base/UIni.pas b/unicode/src/base/UIni.pas
index 241b34e8..9a09ca91 100644
--- a/unicode/src/base/UIni.pas
+++ b/unicode/src/base/UIni.pas
@@ -155,6 +155,7 @@ type
// Controller
Joypad: integer;
+ Mouse: integer;
// default encoding for texts (lyrics, song-name, ...)
EncodingDefault: TEncoding;
@@ -198,14 +199,13 @@ const
IBackgroundMusic: array[0..1] of string = ('Off', 'On');
- ITextureSize: array[0..2] of string = ('128', '256', '512');
- ITextureSizeVals: array[0..2] of integer = ( 128, 256, 512);
+ ITextureSize: array[0..3] of string = ('64', '128', '256', '512');
+ ITextureSizeVals: array[0..3] of integer = ( 64, 128, 256, 512);
ISingWindow: array[0..1] of string = ('Small', 'Big');
//SingBar Mod
- IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar');
-//IOscilloscope: array[0..1] of string = ('Off', 'On');
+ IOscilloscope: array[0..1] of string = ('Off', 'On');
ISpectrum: array[0..1] of string = ('Off', 'On');
ISpectrograph: array[0..1] of string = ('Off', 'On');
@@ -246,10 +246,11 @@ 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..2] of string = ('Off', 'At Score', 'At Notes');
+ ILineBonus: array[0..1] of string = ('Off', 'On');
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');
@@ -686,7 +687,7 @@ begin
SingWindow := GetArrayIndex(ISingWindow, IniFile.ReadString('Graphics', 'SingWindow', 'Big'));
// Oscilloscope
- Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'));
+ Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', IOscilloscope[0]));
// Spectrum
Spectrum := GetArrayIndex(ISpectrum, IniFile.ReadString('Graphics', 'Spectrum', 'Off'));
@@ -713,16 +714,16 @@ begin
PreviewVolume := GetArrayIndex(IPreviewVolume, IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]));
//Preview Fading
- PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]));
+ PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[3]));
//AudioRepeat aka VoicePassthrough
VoicePassthrough := GetArrayIndex(IVoicePassthrough, IniFile.ReadString('Sound', 'VoicePassthrough', IVoicePassthrough[0]));
// Lyrics Font
- LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]));
+ LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[0]));
// Lyrics Effect
- LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]));
+ LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[2]));
// Solmization
Solmization := GetArrayIndex(ISolmization, IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]));
@@ -770,7 +771,7 @@ begin
OnSongClick := GetArrayIndex(IOnSongClick, IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'));
// Linebonus
- LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', 'At Score'));
+ LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', ILineBonus[1]));
// PartyPopup
PartyPopup := GetArrayIndex(IPartyPopup, IniFile.ReadString('Advanced', 'PartyPopup', 'On'));
@@ -778,6 +779,9 @@ begin
// Joypad
Joypad := GetArrayIndex(IJoypad, IniFile.ReadString('Controller', 'Joypad', IJoypad[0]));
+ // Mouse
+ Mouse := GetArrayIndex(IMouse, IniFile.ReadString('Controller', 'Mouse', IMouse[2]));
+
LoadPaths(IniFile);
IniFile.Free;
@@ -920,6 +924,9 @@ 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 8d11b91d..1962e953 100644
--- a/unicode/src/base/UMain.pas
+++ b/unicode/src/base/UMain.pas
@@ -66,11 +66,6 @@ implementation
uses
Math,
gl,
-{
- SDL_ttf,
- UParty,
- UCore,
-}
UCatCovers,
UCommandLine,
UCommon,
@@ -88,10 +83,12 @@ uses
UPath,
UPlaylist,
UMusic,
+ UBeatTimer,
UPlatform,
USkins,
USongs,
UThemes,
+ UParty,
UTime;
procedure Main;
@@ -236,14 +233,12 @@ 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);
@@ -364,9 +359,11 @@ 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;
@@ -380,9 +377,26 @@ 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;
+ Event: TSDL_event;
+ mouseDown: boolean;
+ mouseBtn: integer;
begin
if Assigned(Display.NextScreen) then
Exit;
@@ -396,17 +410,46 @@ begin
Display.NextScreenWithCheck := nil;
Display.CheckOK := true;
end;
- SDL_MOUSEBUTTONDOWN:
+
+ SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP:
begin
-{
- with Event.button do
+ if (Ini.Mouse > 0) then
begin
- if State = SDL_BUTTON_LEFT then
+ 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
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
@@ -442,14 +485,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
@@ -469,19 +512,7 @@ begin
// if screen wants to exit
if Done then
- 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;
+ DoQuit;
end;
end;
diff --git a/unicode/src/base/UModules.pas b/unicode/src/base/UModules.pas
deleted file mode 100644
index 97494180..00000000
--- a/unicode/src/base/UModules.pas
+++ /dev/null
@@ -1,55 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit UModules;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-{*********************
- UModules
- Unit Contains all used Modules in its uses clausel
- and a const with an array of all Modules to load
-*********************}
-
-uses
- UCoreModule,
- UPluginLoader;
-
-const
- CORE_MODULES_TO_LOAD: Array[0..2] of cCoreModule = (
- TPluginLoader, //First because it has to look if there are Module replacements (Feature o/t Future)
- TCoreModule, //Remove this later, just a dummy
- TtehPlugins //Represents the Plugins. Last because they may use CoreModules Services etc.
- );
-
-implementation
-
-end. \ No newline at end of file
diff --git a/unicode/src/base/UMusic.pas b/unicode/src/base/UMusic.pas
index 19c3b942..5fc9805f 100644
--- a/unicode/src/base/UMusic.pas
+++ b/unicode/src/base/UMusic.pas
@@ -36,7 +36,8 @@ interface
uses
UTime,
SysUtils,
- Classes;
+ Classes,
+ UBeatTimer;
type
TNoteType = (ntFreestyle, ntNormal, ntGolden);
@@ -99,51 +100,6 @@ 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
@@ -977,92 +933,6 @@ 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 5e70bfe1..6da4cf07 100644
--- a/unicode/src/base/UNote.pas
+++ b/unicode/src/base/UNote.pas
@@ -126,12 +126,10 @@ 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 937aab78..b02d13be 100644
--- a/unicode/src/base/UParty.pas
+++ b/unicode/src/base/UParty.pas
@@ -34,208 +34,85 @@ interface
{$I switches.inc}
uses
- UPartyDefs,
- UCoreModule,
- UPluginDefs;
+ ModiSDK;
type
- ARounds = array [0..252] of integer; //0..252 needed for
- PARounds = ^ARounds;
-
TRoundInfo = record
- Modi: cardinal;
+ Plugin: word;
Winner: byte;
end;
TeamOrderEntry = record
- Teamnum: byte;
- Score: byte;
+ TeamNum: byte;
+ Score: byte;
end;
TeamOrderArray = array[0..5] of byte;
- TUS_ModiInfoEx = record
- Info: TUS_ModiInfo;
- Owner: integer;
- TimesPlayed: byte; //Helper for setting round plugins
+ TPartyPlugin = record
+ ID: byte;
+ TimesPlayed: byte;
end;
- TPartySession = class (TCoreModule)
+ TPartySession = class
private
- bPartyMode: boolean; //Is this party or single player
- CurRound: byte;
-
- Modis: array of TUS_ModiInfoEx;
- Teams: TTeamInfo;
-
+ function GetRandomPlayer(Team: byte): byte;
+ function GetRandomPlugin(Plugins: array of TPartyPlugin): byte;
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
+ Teams: TTeamInfo;
+ Rounds: array of TRoundInfo;
+ CurRound: byte;
+
+ constructor Create;
+
+ procedure StartNewParty(NumRounds: byte);
+ procedure StartRound;
+ procedure EndRound;
+ function GetTeamOrder: TeamOrderArray;
+ function GetWinnerString(Round: byte): string;
end;
-const
- StandardModus = 0; //Modus ID that will be played in non-party mode
+var
+ PartySession: TPartySession;
implementation
uses
- UCore,
+ UDLLManager,
UGraphic,
- ULanguage,
- 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;
+ ULanguage,
+ ULog;
-//-------------
-// 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(TeamMode: boolean): cardinal;
+function TPartySession.GetRandomPlugin(Plugins: array of TPartyPlugin): byte;
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(Modis) do
+ for I := 0 to high(Plugins) do
begin
- if (Modis[I].TimesPlayed < lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
+ if (Plugins[I].TimesPlayed < lowestTP) then
begin
- lowestTP := Modis[I].TimesPlayed;
+ lowestTP := Plugins[I].TimesPlayed;
NumPwithLTP := 1;
end
- else if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
+ else if (Plugins[I].TimesPlayed = lowestTP) then
begin
Inc(NumPwithLTP);
end;
@@ -245,118 +122,97 @@ begin
R := Random(NumPwithLTP);
//Search for random plugin
- for I := 0 to high(Modis) do
+ for I := 0 to high(Plugins) do
begin
- if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
+ if Plugins[I].TimesPlayed = LowestTP then
begin
//Plugin found
if (R = 0) then
begin
- Result := I;
- Inc(Modis[I].TimesPlayed);
+ Result := Plugins[I].ID;
+ Inc(Plugins[I].TimesPlayed);
Break;
end;
-
Dec(R);
end;
end;
end;
//----------
-// Starts new party mode. Returns non zero on success
+//StartNewParty - Reset and prepares for new party
//----------
-function TPartySession.StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer;
+procedure TPartySession.StartNewParty(NumRounds: byte);
var
- I: integer;
- aiRounds: PARounds;
+ Plugins: array of TPartyPlugin;
TeamMode: boolean;
+ Len: integer;
+ I, J: integer;
begin
- 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;
-
- CurRound := High(byte); //Set CurRound to not defined
+ //Set current round to 1
+ CurRound := 255;
- //Return true and set party mode
- bPartyMode := true;
- Result := 1;
+ PlayersPlay := Teams.NumTeams;
- except
- Core.ReportError(integer(PChar('Can''t start party mode.')), PChar('TPartySession'));
+ //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;
+ end;
+ Teams.Teaminfo[I].Joker := Round(NumRounds * 0.7);
+ Teams.Teaminfo[I].Score := 0;
end;
-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]);
+ //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;
end;
-end;
-//----------
-// 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
+ //Set rounds
+ if (Length(Plugins) >= 1) then
begin
- // to-do : Whitü: Check here if sing screen is not shown atm.
- bPartyMode := false;
- Result := 1;
+ SetLength (Rounds, NumRounds);
+ for I := 0 to NumRounds - 1 do
+ begin
+ PartySession.Rounds[I].Plugin := GetRandomPlugin(Plugins);
+ PartySession.Rounds[I].Winner := 255;
+ end;
end
else
- Result := 0;
+ SetLength (Rounds, 0);
end;
-//----------
-//GetRandomPlayer - gives back a random player to play next round
-//----------
+{**
+ * Returns 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
@@ -369,11 +225,11 @@ begin
end;
end;
- //Create random no
+ //Create random number
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
@@ -389,212 +245,93 @@ begin
end;
end;
-//----------
-// 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;
+{**
+ * Prepares ScreenSingModi for next round and loads plugin
+ *}
+procedure TPartySession.StartRound;
var
I: integer;
begin
if ((CurRound < high(Rounds)) or (CurRound = high(CurRound))) then
- begin //everythings OK! -> Start the Round, maaaaan
+ begin
+ //Increase Current Round
Inc(CurRound);
- //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;
+ Rounds[CurRound].Winner := 255;
+ DllMan.LoadPlugin(Rounds[CurRound].Plugin);
-//----------
-// 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;
+ //Select Players
+ for I := 0 to Teams.NumTeams - 1 do
+ Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I);
- 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;
+ //Set ScreenSingModie Variables
+ ScreenSingModi.TeamInfo := Teams;
end;
-
- // FIXME: return a valid result
- Result := 0;
end;
//----------
-// CallModiDeInit - calls DeInitProc and ends the round
+//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray
//----------
-function TPartySession.CallModiDeInit(wParam: TwParam; lParam: TlParam): integer;
+procedure TPartySession.EndRound;
var
- I: integer;
- MaxScore: word;
+ I: Integer;
begin
- 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;
+ //Copy Winner
+ Rounds[CurRound].Winner := ScreenSingModi.Winner;
+ //Set Scores
+ GenScores;
- //Generate the scores
- GenScores;
+ //Increase TimesPlayed 4 all Players
+ For I := 0 to Teams.NumTeams-1 do
+ Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed);
- //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;
//----------
-// GetTeamInfo - writes TTeamInfo record to pointer at lParam. Returns zero on success
+//IsWinner - returns true if the player's bit is set in the winner byte
//----------
-function TPartySession.GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer;
+function TPartySession.IsWinner(Player, Winner: byte): boolean;
var
- Info: ^TTeamInfo;
+ Mask: byte;
begin
- 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;
+ Mask := 1 shl Player;
+ Result := (Winner and Mask) <> 0;
end;
//----------
-// SetTeamInfo - read TTeamInfo record from pointer at lParam. Returns zero on success
+//GenScores - increase scores for current round
//----------
-function TPartySession.SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer;
+procedure TPartySession.GenScores;
var
- TeamInfobackup: TTeamInfo;
- Info: ^TTeamInfo;
+ I: byte;
begin
- Result := -1;
- Info := pTeamInfo;
- if (Info <> nil) then
+ for I := 0 to Teams.NumTeams - 1 do
begin
- 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;
+ if isWinner(I, Rounds[CurRound].Winner) then
+ Inc(Teams.Teaminfo[I].Score);
end;
end;
//----------
-// GetTeamOrder - returns team order. Structure: Bits 1..3: Team at place1; Bits 4..6: Team at place2 ...
+//GetTeamOrder - returns the placement of each Team [First Position of Array is Teamnum of first placed Team, ...]
//----------
-function TPartySession.GetTeamOrder(wParam: TwParam; lParam: TlParam): integer;
+function TPartySession.GetTeamOrder: TeamOrderArray;
var
- I, J: integer;
- ATeams: array [0..5] of TeamOrderEntry;
+ I, J: integer;
+ ATeams: array [0..5] of TeamOrderEntry;
TempTeam: TeamOrderEntry;
begin
- // to-do : PartyMode: Write this in another way, so that teams with the same score get the same place
+ // TODO: 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];
@@ -603,63 +340,44 @@ begin
end;
//Copy to Result
- Result := 0;
for I := 0 to Teams.NumTeams-1 do
- Result := Result or (ATeams[I].TeamNum Shl I*3);
+ Result[I] := ATeams[I].TeamNum;
end;
//----------
-// GetWinnerString - wParam is Roundnum. If (pointer = nil) then return length of the string. Otherwise write the string to address at lParam
+//GetWinnerString - Get string with WinnerTeam Name, when there is more than one Winner than Connect with and or ,
//----------
-function TPartySession.GetWinnerString(wParam: TwParam; lParam: TlParam): integer;
+function TPartySession.GetWinnerString(Round: byte): string;
var
Winners: array of UTF8String;
- I: integer;
- ResultStr: String;
- S: ^String;
+ I: integer;
begin
- ResultStr := Language.Translate('PARTY_NOBODY');
+ Result := Language.Translate('PARTY_NOBODY');
+
+ if (Round > High(Rounds)) then
+ exit;
- if (wParam <= High(Rounds)) then
+ if (Rounds[Round].Winner = 0) then
begin
- 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;
+ 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;
+ if (Rounds[Round].Winner = 255) then
+ begin
+ Result := Language.Translate('PARTY_NOTPLAYEDYET');
+ exit;
+ end;
+ 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 e4cb6f0c..6f13481c 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 have modified it to use the Platform_singleton in this location ( in the implementaiton )
+// I modified it to use the Platform_singleton in this location (in the implementation)
// 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/UPluginInterface.pas b/unicode/src/base/UPluginInterface.pas
deleted file mode 100644
index f299796f..00000000
--- a/unicode/src/base/UPluginInterface.pas
+++ /dev/null
@@ -1,186 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit uPluginInterface;
-{*********************
- uPluginInterface
- Unit fills a TPluginInterface structure with method pointers
- Unit contains all functions called directly by plugins
-*********************}
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- uPluginDefs;
-
-//---------------
-// Methods for Plugin
-//---------------
- {******** Hook specific Methods ********}
- {Function Creates a new Hookable Event and Returns the Handle
- or 0 on Failure. (Name already exists)}
- Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
-
- {Function Destroys an Event and Unhooks all Hooks to this Event.
- 0 on success, not 0 on Failure}
- Function DestroyHookableEvent (hEvent: THandle): integer; stdcall;
-
- {Function start calling the Hook Chain
- 0 if Chain is called until the End, -1 if Event Handle is not valid
- otherwise Return Value of the Hook that breaks the Chain}
- Function NotivyEventHooks (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall;
-
- {Function Hooks an Event by Name.
- Returns Hook Handle on Success, otherwise 0}
- Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
-
- {Function Removes the Hook from the Chain
- Returns 0 on Success}
- Function UnHookEvent (hHook: THandle): Integer; stdcall;
-
- {Function Returns Non Zero if a Event with the given Name Exists,
- otherwise 0}
- Function EventExists (EventName: PChar): Integer; stdcall;
-
- {******** Service specific Methods ********}
- {Function Creates a new Service and Returns the Services Handle
- or 0 on Failure. (Name already exists)}
- Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
-
- {Function Destroys a Service.
- 0 on success, not 0 on Failure}
- Function DestroyService (hService: THandle): integer; stdcall;
-
- {Function Calls a Services Proc
- Returns Services Return Value or SERVICE_NOT_FOUND on Failure}
- Function CallService (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall;
-
- {Function Returns Non Zero if a Service with the given Name Exists,
- otherwise 0}
- Function ServiceExists (ServiceName: PChar): Integer; stdcall;
-
-implementation
-uses UCore;
-
-{******** Hook specific Methods ********}
-//---------------
-// Function Creates a new Hookable Event and Returns the Handle
-// or 0 on Failure. (Name already exists)
-//---------------
-Function CreateHookableEvent (EventName: PChar): THandle; stdcall;
-begin
- Result := Core.Hooks.AddEvent(EventName);
-end;
-
-//---------------
-// Function Destroys an Event and Unhooks all Hooks to this Event.
-// 0 on success, not 0 on Failure
-//---------------
-Function DestroyHookableEvent (hEvent: THandle): integer; stdcall;
-begin
- Result := Core.Hooks.DelEvent(hEvent);
-end;
-
-//---------------
-// Function start calling the Hook Chain
-// 0 if Chain is called until the End, -1 if Event Handle is not valid
-// otherwise Return Value of the Hook that breaks the Chain
-//---------------
-Function NotivyEventHooks (hEvent: THandle; wParam: TwParam; lParam: TlParam): integer; stdcall;
-begin
- Result := Core.Hooks.CallEventChain(hEvent, wParam, lParam);
-end;
-
-//---------------
-// Function Hooks an Event by Name.
-// Returns Hook Handle on Success, otherwise 0
-//---------------
-Function HookEvent (EventName: PChar; HookProc: TUS_Hook): THandle; stdcall;
-begin
- Result := Core.Hooks.AddSubscriber(EventName, HookProc);
-end;
-
-//---------------
-// Function Removes the Hook from the Chain
-// Returns 0 on Success
-//---------------
-Function UnHookEvent (hHook: THandle): Integer; stdcall;
-begin
- Result := Core.Hooks.DelSubscriber(hHook);
-end;
-
-//---------------
-// Function Returns Non Zero if a Event with the given Name Exists,
-// otherwise 0
-//---------------
-Function EventExists (EventName: PChar): Integer; stdcall;
-begin
- Result := Core.Hooks.EventExists(EventName);
-end;
-
- {******** Service specific Methods ********}
-//---------------
-// Function Creates a new Service and Returns the Services Handle
-// or 0 on Failure. (Name already exists)
-//---------------
-Function CreateService (ServiceName: PChar; ServiceProc: TUS_Service): THandle; stdcall;
-begin
- Result := Core.Services.AddService(ServiceName, ServiceProc);
-end;
-
-//---------------
-// Function Destroys a Service.
-// 0 on success, not 0 on Failure
-//---------------
-Function DestroyService (hService: THandle): integer; stdcall;
-begin
- Result := Core.Services.DelService(hService);
-end;
-
-//---------------
-// Function Calls a Services Proc
-// Returns Services Return Value or SERVICE_NOT_FOUND on Failure
-//---------------
-Function CallService (ServiceName: PChar; wParam: TwParam; lParam: TlParam): integer; stdcall;
-begin
- Result := Core.Services.CallService(ServiceName, wParam, lParam);
-end;
-
-//---------------
-// Function Returns Non Zero if a Service with the given Name Exists,
-// otherwise 0
-//---------------
-Function ServiceExists (ServiceName: PChar): Integer; stdcall;
-begin
- Result := Core.Services.ServiceExists(ServiceName);
-end;
-
-end.
diff --git a/unicode/src/base/UPluginLoader.pas b/unicode/src/base/UPluginLoader.pas
deleted file mode 100644
index 8836cb78..00000000
--- a/unicode/src/base/UPluginLoader.pas
+++ /dev/null
@@ -1,794 +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/uPluginLoader.pas $
- * $Id: uPluginLoader.pas 1403 2008-09-23 21:17:22Z k-m_schindler $
- *}
-
-unit UPluginLoader;
-{*********************
- UPluginLoader
- Unit contains two classes
- TPluginLoader: Class searching for and loading the plugins
- TtehPlugins: Class representing the plugins in modules chain
-*********************}
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- UPluginDefs,
- UCoreModule,
- UPath;
-
-type
- TPluginListItem = record
- Info: TUS_PluginInfo;
- State: byte; // State of this plugin: 0 - undefined; 1 - loaded; 2 - inited / running; 4 - unloaded; 254 - loading aborted by plugin; 255 - unloaded because of error
- Path: string; // path to this plugin
- NeedsDeInit: boolean; // if this is inited correctly this should be true
- hLib: THandle; // handle of loaded libary
- Procs: record // procs offered by plugin. Don't call this directly use wrappers of TPluginLoader
- Load: Func_Load;
- Init: Func_Init;
- DeInit: Proc_DeInit;
- end;
- end;
- {*********************
- TPluginLoader
- Class searches for plugins and manages loading and unloading
- *********************}
- PPluginLoader = ^TPluginLoader;
- TPluginLoader = class (TCoreModule)
- private
- LoadingProcessFinished: boolean;
- sUnloadPlugin: THandle;
- sLoadPlugin: THandle;
- sGetPluginInfo: THandle;
- sGetPluginState: THandle;
-
- procedure FreePlugin(Index: integer);
- public
- PluginInterface: TUS_PluginInterface;
- Plugins: array of TPluginListItem;
-
- // 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;
-
- // New methods
- procedure BrowseDir(Path: string); // browses the path at _Path_ for plugins
- function PluginExists(Name: string): integer; // if plugin exists: Index of plugin, else -1
- procedure AddPlugin(Filename: string); // adds plugin to the array
-
- function CallLoad(Index: integer): integer;
- function CallInit(Index: integer): integer;
- procedure CallDeInit(Index: integer);
-
- //Services offered
- function LoadPlugin(wParam: TwParam; lParam: TlParam): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin
- function UnloadPlugin(wParam: TwParam; lParam: TlParam): integer; //wParam PChar(PluginName/PluginPath) | lParam (if wParam = nil) ID of the Plugin
- function GetPluginInfo(wParam: TwParam; lParam: TlParam): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) else (Get PluginInfo of Plugin with Index(wParam) to Address at lParam)
- function GetPluginState(wParam: TwParam; lParam: TlParam): integer; //If wParam = -1 then (If lParam = nil then get length of Moduleinfo Array. If lparam <> nil then write array of TUS_PluginInfo to address at lparam) else (Return PluginInfo of Plugin with Index(wParam))
-
- end;
-
- {*********************
- TtehPlugins
- Class represents the plugins in module chain.
- It calls the plugins procs and funcs
- *********************}
- TtehPlugins = class (TCoreModule)
- private
- PluginLoader: PPluginLoader;
- public
- // TCoreModule methods to inherit
- constructor Create; override;
-
- procedure Info(const pInfo: PModuleInfo); override;
- function Load: boolean; override;
- function Init: boolean; override;
- procedure DeInit; override;
- end;
-
-const
-{$IF Defined(MSWINDOWS)}
- PluginFileExtension = '.dll';
-{$ELSEIF Defined(DARWIN)}
- PluginFileExtension = '.dylib';
-{$ELSEIF Defined(UNIX)}
- PluginFileExtension = '.so';
-{$IFEND}
-
-implementation
-
-uses
- UCore,
- UPluginInterface,
-{$IFDEF MSWINDOWS}
- windows,
-{$ELSE}
- dynlibs,
-{$ENDIF}
- UMain,
- SysUtils;
-
-{*********************
- TPluginLoader
- Implementation
-*********************}
-
-//-------------
-// function that gives some infos about the module to the core
-//-------------
-procedure TPluginLoader.Info(const pInfo: PModuleInfo);
-begin
- pInfo^.Name := 'TPluginLoader';
- pInfo^.Version := MakeVersion(1,0,0,chr(0));
- pInfo^.Description := 'Searches for plugins, loads and unloads them';
-end;
-
-//-------------
-// Just the constructor
-//-------------
-constructor TPluginLoader.Create;
-begin
- inherited;
-
- // Init PluginInterface
- // Using methods from UPluginInterface
- PluginInterface.CreateHookableEvent := CreateHookableEvent;
- PluginInterface.DestroyHookableEvent := DestroyHookableEvent;
- PluginInterface.NotivyEventHooks := NotivyEventHooks;
- PluginInterface.HookEvent := HookEvent;
- PluginInterface.UnHookEvent := UnHookEvent;
- PluginInterface.EventExists := EventExists;
-
- PluginInterface.CreateService := @CreateService;
- PluginInterface.DestroyService := DestroyService;
- PluginInterface.CallService := CallService;
- PluginInterface.ServiceExists := ServiceExists;
-
- // UnSet private var
- LoadingProcessFinished := 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 TPluginLoader.Load: boolean;
-begin
- Result := true;
-
- try
- // Start searching for plugins
- BrowseDir(PluginPath);
- except
- Result := false;
- Core.ReportError(integer(PChar('Error browsing and loading.')), PChar('TPluginLoader'));
- end;
-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 TPluginLoader.Init: boolean;
-begin
- // Just set private var to true.
- LoadingProcessFinished := true;
- Result := true;
-end;
-
-//-------------
-// Is called if this module has been inited and there is a exit.
-// Deinit is in backwards initing order
-//-------------
-procedure TPluginLoader.DeInit;
-var
- I: integer;
-begin
- // Force deinit
- // if some plugins aren't deinited for some reason o0
- for I := 0 to High(Plugins) do
- begin
- if (Plugins[I].State < 4) then
- FreePlugin(I);
- end;
-
- // Nothing to do here. Core will remove the hooks
-end;
-
-//-------------
-// Is called if this module will be unloaded and has been created
-// Should be used to free memory
-//-------------
-Destructor TPluginLoader.Destroy;
-begin
- // Just save some memory if it wasn't done now..
- SetLength(Plugins, 0);
- inherited;
-end;
-
-//--------------
-// Browses the path at _Path_ for plugins
-//--------------
-procedure TPluginLoader.BrowseDir(Path: string);
-var
- SR: TSearchRec;
-begin
- // Search for other dirs to browse
- if FindFirst(Path + '*', faDirectory, SR) = 0 then begin
- repeat
- if (SR.Name <> '.') and (SR.Name <> '..') then
- BrowseDir(Path + Sr.Name + PathDelim);
- until FindNext(SR) <> 0;
- end;
- FindClose(SR);
-
- // Search for plugins at path
- if FindFirst(Path + '*' + PluginFileExtension, 0, SR) = 0 then
- begin
- repeat
- AddPlugin(Path + SR.Name);
- until FindNext(SR) <> 0;
- end;
- FindClose(SR);
-end;
-
-//--------------
-// If plugin exists: Index of plugin, else -1
-//--------------
-function TPluginLoader.PluginExists(Name: string): integer;
-var
- I: integer;
-begin
- Result := -1;
-
- if (Length(Name) <= 32 { =>Length(TUS_PluginInfo.Name)}) then
- begin
- for I := 0 to High(Plugins) do
- if (Plugins[I].Info.Name = Name) then
- begin //Found the Plugin
- Result := I;
- Break;
- end;
- end;
-end;
-
-//--------------
-// Adds plugin to the array
-//--------------
-procedure TPluginLoader.AddPlugin(Filename: string);
-var
- hLib: THandle;
- PInfo: Proc_PluginInfo;
- Info: TUS_PluginInfo;
- PluginID: integer;
-begin
- if (FileExists(Filename)) then
- begin //Load Libary
- hLib := LoadLibrary(PChar(Filename));
- if (hLib <> 0) then
- begin // Try to get address of the info proc
- PInfo := GetProcAddress (hLib, PChar('USPlugin_Info'));
- if (@PInfo <> nil) then
- begin
- Info.cbSize := SizeOf(TUS_PluginInfo);
-
- try // Call info proc
- PInfo(@Info);
- except
- Info.Name := '';
- Core.ReportError(integer(PChar('Error getting plugin info: ' + Filename)), PChar('TPluginLoader'));
- end;
-
- // Is name set ?
- if (Trim(Info.Name) <> '') then
- begin
- PluginID := PluginExists(Info.Name);
-
- if (PluginID > 0) and (Plugins[PluginID].State >=4) then
- PluginID := -1;
-
- if (PluginID = -1) then
- begin
- // Add new item to array
- PluginID := Length(Plugins);
- SetLength(Plugins, PluginID + 1);
-
- // Fill with info:
- Plugins[PluginID].Info := Info;
- Plugins[PluginID].State := 0;
- Plugins[PluginID].Path := Filename;
- Plugins[PluginID].NeedsDeInit := false;
- Plugins[PluginID].hLib := hLib;
-
- // Try to get procs
- Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load'));
- Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init'));
- Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit'));
-
- if (@Plugins[PluginID].Procs.Load = nil) or (@Plugins[PluginID].Procs.Init = nil) or (@Plugins[PluginID].Procs.DeInit = nil) then
- begin
- Plugins[PluginID].State := 255;
- FreeLibrary(hLib);
- Core.ReportError(integer(PChar('Can''t get plugin procs from libary: "' + Info.Name + '" ' + Filename)), PChar('TPluginLoader'));
- end;
-
- // Emulate loading process if this plugin is loaded too late
- if (LoadingProcessFinished) then
- begin
- CallLoad(PluginID);
- CallInit(PluginID);
- end;
- end
- else if (LoadingProcessFinished = false) then
- begin
- if (Plugins[PluginID].Info.Version < Info.Version) then
- begin // Found newer version of this plugin
- Core.ReportDebug(integer(PChar('Found a newer version of plugin: ' + string(Info.Name))), PChar('TPluginLoader'));
-
- // Unload old plugin
- UnloadPlugin(PluginID, nil);
-
- // Fill with new info
- Plugins[PluginID].Info := Info;
- Plugins[PluginID].State := 0;
- Plugins[PluginID].Path := Filename;
- Plugins[PluginID].NeedsDeInit := false;
- Plugins[PluginID].hLib := hLib;
-
- // Try to get procs
- Plugins[PluginID].Procs.Load := GetProcAddress (hLib, PChar('USPlugin_Load'));
- Plugins[PluginID].Procs.Init := GetProcAddress (hLib, PChar('USPlugin_Init'));
- Plugins[PluginID].Procs.DeInit := GetProcAddress (hLib, PChar('USPlugin_DeInit'));
-
- if (@Plugins[PluginID].Procs.Load = nil) or (@Plugins[PluginID].Procs.Init = nil) or (@Plugins[PluginID].Procs.DeInit = nil) then
- begin
- FreeLibrary(hLib);
- Plugins[PluginID].State := 255;
- Core.ReportError(integer(PChar('Can''t get plugin procs from libary: "' + Info.Name + '" ' + Filename)), PChar('TPluginLoader'));
- end;
- end
- else
- begin // Newer Version already loaded
- FreeLibrary(hLib);
- end;
- end
- else
- begin
- FreeLibrary(hLib);
- Core.ReportError(integer(PChar('Plugin with this name already exists: ' + string(Info.Name))), PChar('TPluginLoader'));
- end;
- end
- else
- begin
- FreeLibrary(hLib);
- Core.ReportError(integer(PChar('No name reported: ' + Filename)), PChar('TPluginLoader'));
- end;
- end
- else
- begin
- FreeLibrary(hLib);
- Core.ReportError(integer(PChar('Can''t find info procedure: ' + Filename)), PChar('TPluginLoader'));
- end;
- end
- else
- Core.ReportError(integer(PChar('Can''t load plugin libary: ' + Filename)), PChar('TPluginLoader'));
- end;
-end;
-
-//--------------
-// Calls load func of plugin with the given index
-//--------------
-function TPluginLoader.CallLoad(Index: integer): integer;
-begin
- Result := -2;
- if(Index < Length(Plugins)) then
- begin
- if (@Plugins[Index].Procs.Load <> nil) and (Plugins[Index].State = 0) then
- begin
- try
- Result := Plugins[Index].Procs.Load(@PluginInterface);
- except
- Result := -3;
- end;
-
- if (Result = 0) then
- Plugins[Index].State := 1
- else
- begin
- FreePlugin(Index);
- Plugins[Index].State := 255;
- Core.ReportError(integer(PChar('Error calling load function from plugin: ' + string(Plugins[Index].Info.Name))), PChar('TPluginLoader'));
- end;
- end;
- end;
-end;
-
-//--------------
-// Calls init func of plugin with the given index
-//--------------
-function TPluginLoader.CallInit(Index: integer): integer;
-begin
- Result := -2;
- if(Index < Length(Plugins)) then
- begin
- if (@Plugins[Index].Procs.Init <> nil) and (Plugins[Index].State = 1) then
- begin
- try
- Result := Plugins[Index].Procs.Init(@PluginInterface);
- except
- Result := -3;
- end;
-
- if (Result = 0) then
- begin
- Plugins[Index].State := 2;
- Plugins[Index].NeedsDeInit := true;
- end
- else
- begin
- FreePlugin(Index);
- Plugins[Index].State := 255;
- Core.ReportError(integer(PChar('Error calling init function from plugin: ' + string(Plugins[Index].Info.Name))), PChar('TPluginLoader'));
- end;
- end;
- end;
-end;
-
-//--------------
-// Calls deinit proc of plugin with the given index
-//--------------
-procedure TPluginLoader.CallDeInit(Index: integer);
-begin
- if(Index < Length(Plugins)) then
- begin
- if (Plugins[Index].State < 4) then
- begin
- if (@Plugins[Index].Procs.DeInit <> nil) and (Plugins[Index].NeedsDeInit) then
- try
- Plugins[Index].Procs.DeInit(@PluginInterface);
- except
-
- end;
-
- // Don't forget to remove services and subscriptions by this plugin
- Core.Hooks.DelbyOwner(-1 - Index);
-
- FreePlugin(Index);
- end;
- end;
-end;
-
-//--------------
-// Frees all plugin sources (procs and handles) - helper for deiniting functions
-//--------------
-procedure TPluginLoader.FreePlugin(Index: integer);
-begin
- Plugins[Index].State := 4;
- Plugins[Index].Procs.Load := nil;
- Plugins[Index].Procs.Init := nil;
- Plugins[Index].Procs.DeInit := nil;
-
- if (Plugins[Index].hLib <> 0) then
- FreeLibrary(Plugins[Index].hLib);
-end;
-
-//--------------
-// wParam PChar(PluginName/PluginPath) | wParam (if lParam = nil) ID of the plugin
-//--------------
-function TPluginLoader.LoadPlugin(wParam: TwParam; lParam: TlParam): integer;
-var
- Index: integer;
- sFile: string;
-begin
- Result := -1;
- sFile := '';
- // lParam is ID
- if (lParam = nil) then
- begin
- Index := wParam;
- end
- else
- begin //lParam is PChar
- try
- sFile := string(PChar(lParam));
- Index := PluginExists(sFile);
- if (Index < 0) and FileExists(sFile) then
- begin // Is filename
- AddPlugin(sFile);
- Result := Plugins[High(Plugins)].State;
- end;
- except
- Index := -2;
- end;
- end;
-
- if (Index >= 0) and (Index < Length(Plugins)) then
- begin
- AddPlugin(Plugins[Index].Path);
- Result := Plugins[Index].State;
- end;
-end;
-
-//--------------
-// wParam PChar(PluginName/PluginPath) | wParam (if lParam = nil) ID of the plugin
-//--------------
-function TPluginLoader.UnloadPlugin(wParam: TwParam; lParam: TlParam): integer;
-var
- Index: integer;
- sName: string;
-begin
- Result := -1;
- // lParam is ID
- if (lParam = nil) then
- begin
- Index := wParam;
- end
- else
- begin // wParam is PChar
- try
- sName := string(PChar(lParam));
- Index := PluginExists(sName);
- except
- Index := -2;
- end;
- end;
-
- if (Index >= 0) and (Index < Length(Plugins)) then
- CallDeInit(Index)
-end;
-
-//--------------
-// if wParam = -1 then (if lParam = nil then get length of moduleinfo array. if lparam <> nil then write array of TUS_PluginInfo to address at lparam) else (Get PluginInfo of plugin with Index(wParam) to address at lParam)
-//--------------
-function TPluginLoader.GetPluginInfo(wParam: TwParam; lParam: TlParam): integer;
-var I: integer;
-begin
- Result := 0;
- if (wParam > 0) then
- begin // Get info of 1 plugin
- if (lParam <> nil) and (wParam < Length(Plugins)) then
- begin
- try
- Result := 1;
- PUS_PluginInfo(lParam)^ := Plugins[wParam].Info;
- except
-
- end;
- end;
- end
- else if (lParam = nil) then
- begin // Get length of plugin (info) array
- Result := Length(Plugins);
- end
- else //Write PluginInfo Array to Address in lParam
- begin
- try
- for I := 0 to high(Plugins) do
- PAUS_PluginInfo(lParam)^[I] := Plugins[I].Info;
- Result := Length(Plugins);
- except
- Core.ReportError(integer(PChar('Could not write PluginInfo Array')), PChar('TPluginLoader'));
- end;
- end;
-
-end;
-
-//--------------
-// if wParam = -1 then (if lParam = nil then get length of plugin state array. if lparam <> nil then write array of byte to address at lparam) else (return state of plugin with index(wParam))
-//--------------
-function TPluginLoader.GetPluginState(wParam: TwParam; lParam: TlParam): integer;
-var I: integer;
-begin
- Result := -1;
- if (wParam > 0) then
- begin // Get state of 1 plugin
- if (wParam < Length(Plugins)) then
- begin
- Result := Plugins[wParam].State;
- end;
- end
- else if (lParam = nil) then
- begin // Get length of plugin (info) array
- Result := Length(Plugins);
- end
- else // Write plugininfo array to address in lParam
- begin
- try
- for I := 0 to high(Plugins) do
- byte(Pointer(integer(lParam) + I)^) := Plugins[I].State;
- Result := Length(Plugins);
- except
- Core.ReportError(integer(PChar('Could not write pluginstate array')), PChar('TPluginLoader'));
- end;
- end;
-end;
-
-{*********************
- TtehPlugins
- Implementation
-*********************}
-
-//-------------
-// function that gives some infos about the module to the core
-//-------------
-procedure TtehPlugins.Info(const pInfo: PModuleInfo);
-begin
- pInfo^.Name := 'TtehPlugins';
- pInfo^.Version := MakeVersion(1,0,0,chr(0));
- pInfo^.Description := 'Module executing the Plugins!';
-end;
-
-//-------------
-// Just the constructor
-//-------------
-constructor TtehPlugins.Create;
-begin
- inherited;
- PluginLoader := nil;
-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 TtehPlugins.Load: boolean;
-var
- i: integer; // Counter
- CurExecutedBackup: integer; //backup of Core.CurExecuted Attribute
-begin
- // Get pointer to pluginloader
- PluginLoader := PPluginLoader(Core.GetModulebyName('TPluginLoader'));
- if (PluginLoader = nil) then
- begin
- Result := false;
- Core.ReportError(integer(PChar('Could not get pointer to pluginLoader')), PChar('TtehPlugins'));
- end
- else
- begin
- Result := true;
-
- // Backup curexecuted
- CurExecutedBackup := Core.CurExecuted;
-
- // Start loading the plugins
- for i := 0 to High(PluginLoader.Plugins) do
- begin
- Core.CurExecuted := -1 - i;
-
- try
- // Unload plugin if not correctly executed
- if (PluginLoader.CallLoad(i) <> 0) then
- begin
- PluginLoader.CallDeInit(i);
- PluginLoader.Plugins[i].State := 254; // Plugin asks for unload
- Core.ReportDebug(integer(PChar('Plugin selfabort during loading process: ' + string(PluginLoader.Plugins[i].Info.Name))), PChar('TtehPlugins'));
- end
- else
- begin
- Core.ReportDebug(integer(PChar('Plugin loaded succesfully: ' + string(PluginLoader.Plugins[i].Info.Name))), PChar('TtehPlugins'));
- end;
- except
- // Plugin could not be loaded.
- // => Show error message, then shutdown plugin
- on E: Exception do
- begin
- PluginLoader.CallDeInit(i);
- PluginLoader.Plugins[i].State := 255; // Plugin causes error
- Core.ReportError(integer(PChar('Plugin causes error during loading process: ' + PluginLoader.Plugins[i].Info.Name + ', ErrorMsg: "' + E.Message + '"')), PChar('TtehPlugins'));
- end;
- end;
- end;
-
- // Reset CurExecuted
- Core.CurExecuted := CurExecutedBackup;
- end;
-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 TtehPlugins.Init: boolean;
-var
- i: integer; // Counter
- CurExecutedBackup: integer; // backup of Core.CurExecuted attribute
-begin
- Result := true;
-
- // Backup CurExecuted
- CurExecutedBackup := Core.CurExecuted;
-
- // Start loading the plugins
- for i := 0 to High(PluginLoader.Plugins) do
- try
- Core.CurExecuted := -1 - i;
-
- // Unload plugin if not correctly executed
- if (PluginLoader.CallInit(i) <> 0) then
- begin
- PluginLoader.CallDeInit(i);
- PluginLoader.Plugins[i].State := 254; //Plugin asks for unload
- Core.ReportDebug(integer(PChar('Plugin selfabort during init process: ' + string(PluginLoader.Plugins[i].Info.Name))), PChar('TtehPlugins'));
- end
- else
- Core.ReportDebug(integer(PChar('Plugin inited succesfully: ' + string(PluginLoader.Plugins[i].Info.Name))), PChar('TtehPlugins'));
- except
- // Plugin could not be loaded.
- // => Show error message, then shut down plugin
- PluginLoader.CallDeInit(i);
- PluginLoader.Plugins[i].State := 255; //Plugin causes Error
- Core.ReportError(integer(PChar('Plugin causes error during init process: ' + string(PluginLoader.Plugins[i].Info.Name))), PChar('TtehPlugins'));
- end;
-
- // Reset CurExecuted
- Core.CurExecuted := CurExecutedBackup;
-end;
-
-//-------------
-// Is called if this module has been inited and there is a exit.
-// Deinit is in backwards initing order
-//-------------
-procedure TtehPlugins.DeInit;
-var
- i: integer; // Counter
- CurExecutedBackup: integer; // backup of Core.CurExecuted attribute
-begin
- // Backup CurExecuted
- CurExecutedBackup := Core.CurExecuted;
-
- // Start loop
-
- for i := 0 to High(PluginLoader.Plugins) do
- begin
- try
- // DeInit plugin
- PluginLoader.CallDeInit(i);
- except
- end;
- end;
-
- // Reset CurExecuted
- Core.CurExecuted := CurExecutedBackup;
-end;
-
-end.
diff --git a/unicode/src/base/URecord.pas b/unicode/src/base/URecord.pas
index 8f37262d..2c2093a0 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: cardinal);
+ procedure BoostBuffer(Buffer: PByteArray; Size: integer);
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: cardinal;
+ procedure HandleMicrophoneData(Buffer: PByteArray; Size: integer;
InputDevice: TAudioInputDevice);
end;
@@ -459,7 +459,7 @@ begin
Result := '-';
end;
-procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: cardinal);
+procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: integer);
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: cardinal; InputDevice: TAudioInputDevice);
+procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: PByteArray; Size: integer; 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,13 +611,11 @@ 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/UServices.pas b/unicode/src/base/UServices.pas
deleted file mode 100644
index 3783c543..00000000
--- a/unicode/src/base/UServices.pas
+++ /dev/null
@@ -1,384 +0,0 @@
-{* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *}
-
-unit UServices;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- uPluginDefs,
- SysUtils;
-{*********************
- TServiceManager
- Class for saving, managing and calling of Services.
- Saves all Services and their Procs
-*********************}
-
-type
- TServiceName = String[60];
- PServiceInfo = ^TServiceInfo;
- TServiceInfo = record
- Self: THandle; //Handle of this Service
- Hash: Integer; //4 Bit Hash of the Services Name
- Name: TServiceName; //Name of this Service
-
- Owner: Integer; //If < 0 [-(DLLMan Pluginindex + 1)]; 0 - undefined, On Error Full shutdown, If < 0 [ModuleIndex - 1]
-
- Next: PServiceInfo; //Pointer to the Next Service in teh list
-
- //Here is s/t tricky
- //To avoid writing of Wrapping Functions to offer a Service from a Class
- //We save a Normal Proc or a Method of a Class
- Case isClass: boolean of
- False: (Proc: TUS_Service); //Proc that will be called on Event
- True: (ProcOfClass: TUS_Service_of_Object);
- end;
-
- TServiceManager = class
- private
- //Managing Service List
- FirstService: PServiceInfo;
- LastService: PServiceInfo;
-
- //Some Speed improvement by caching the last 4 called Services
- //Most of the time a Service is called multiple times
- ServiceCache: Array[0..3] of PServiceInfo;
- NextCacheItem: Byte;
-
- //Next Service added gets this Handle:
- NextHandle: THandle;
- public
- Constructor Create;
-
- Function AddService(const ServiceName: PChar; const Proc: TUS_Service = nil; const ProcofClass: TUS_Service_of_Object = nil): THandle;
- Function DelService(const hService: THandle): integer;
-
- Function CallService(const ServiceName: PChar; const wParam: TwParam; lParam: TlParam): integer;
-
- Function NametoHash(const ServiceName: TServiceName): Integer;
- Function ServiceExists(const ServiceName: PChar): Integer;
- end;
-
-var
- ServiceManager: TServiceManager;
-
-implementation
-uses
- ULog,
- UCore;
-
-//------------
-// Create - Creates Class and Set Standard Values
-//------------
-Constructor TServiceManager.Create;
-begin
- inherited;
-
- FirstService := nil;
- LastService := nil;
-
- ServiceCache[0] := nil;
- ServiceCache[1] := nil;
- ServiceCache[2] := nil;
- ServiceCache[3] := nil;
-
- NextCacheItem := 0;
-
- NextHandle := 1;
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Succesful created!');
- {$ENDIF}
-end;
-
-//------------
-// Function Creates a new Service and Returns the Services Handle,
-// 0 on Failure. (Name already exists)
-//------------
-Function TServiceManager.AddService(const ServiceName: PChar; const Proc: TUS_Service; const ProcofClass: TUS_Service_of_Object): THandle;
-var
- Cur: PServiceInfo;
-begin
- Result := 0;
-
- If (@Proc <> nil) or (@ProcOfClass <> nil) then
- begin
- If (ServiceExists(ServiceName) = 0) then
- begin //There is a Proc and the Service does not already exist
- //Ok Add it!
-
- //Get Memory
- GetMem(Cur, SizeOf(TServiceInfo));
-
- //Fill it with Data
- Cur.Next := nil;
-
- If (@Proc = nil) then
- begin //Use the ProcofClass Method
- Cur.isClass := True;
- Cur.ProcOfClass := ProcofClass;
- end
- else //Use the normal Proc
- begin
- Cur.isClass := False;
- Cur.Proc := Proc;
- end;
-
- Cur.Self := NextHandle;
- //Zero Name
- Cur.Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0;
- Cur.Name := String(ServiceName);
- Cur.Hash := NametoHash(Cur.Name);
-
- //Add Owner to Service
- Cur.Owner := Core.CurExecuted;
-
- //Add Service to the List
- If (FirstService = nil) then
- FirstService := Cur;
-
- If (LastService <> nil) then
- LastService.Next := Cur;
-
- LastService := Cur;
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Service added: ''' + ServiceName + ''', Handle: ' + InttoStr(Cur.Self));
- {$ENDIF}
-
- //Inc Next Handle
- Inc(NextHandle);
- end
- {$IFDEF DEBUG}
- else debugWriteln('ServiceManager: Try to readd Service: ' + ServiceName);
- {$ENDIF}
- end;
-end;
-
-//------------
-// Function Destroys a Service, 0 on success, not 0 on Failure
-//------------
-Function TServiceManager.DelService(const hService: THandle): integer;
-var
- Last, Cur: PServiceInfo;
- I: Integer;
-begin
- Result := -1;
-
- Last := nil;
- Cur := FirstService;
-
- //Search for Service to Delete
- While (Cur <> nil) do
- begin
- If (Cur.Self = hService) then
- begin //Found Service => Delete it
-
- //Delete from List
- If (Last = nil) then //Found first Service
- FirstService := Cur.Next
- Else //Service behind the first
- Last.Next := Cur.Next;
-
- //IF this is the LastService, correct LastService
- If (Cur = LastService) then
- LastService := Last;
-
- //Search for Service in Cache and delete it if found
- For I := 0 to High(ServiceCache) do
- If (ServiceCache[I] = Cur) then
- begin
- ServiceCache[I] := nil;
- end;
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Removed Service succesful: ' + Cur.Name);
- {$ENDIF}
-
- //Free Memory
- Freemem(Cur, SizeOf(TServiceInfo));
-
- //Break the Loop
- Break;
- end;
-
- //Go to Next Service
- Last := Cur;
- Cur := Cur.Next;
- end;
-end;
-
-//------------
-// Function Calls a Services Proc
-// Returns Services Return Value or SERVICE_NOT_FOUND on Failure
-//------------
-Function TServiceManager.CallService(const ServiceName: PChar; const wParam: TwParam; lParam: TlParam): integer;
-var
- SExists: Integer;
- Service: PServiceInfo;
- CurExecutedBackup: Integer; //backup of Core.CurExecuted Attribute
-begin
- Result := SERVICE_NOT_FOUND;
- SExists := ServiceExists(ServiceName);
- If (SExists <> 0) then
- begin
- //Backup CurExecuted
- CurExecutedBackup := Core.CurExecuted;
-
- Service := Pointer(SExists);
-
- If (Service.isClass) then
- //Use Proc of Class
- Result := Service.ProcOfClass(wParam, lParam)
- Else
- //Use normal Proc
- Result := Service.Proc(wParam, lParam);
-
- //Restore CurExecuted
- Core.CurExecuted := CurExecutedBackup;
- end;
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Service ''' + ServiceName + ''' called. Result: ' + InttoStr(Result));
- {$ENDIF}
-end;
-
-//------------
-// Generates the Hash for the given Name
-//------------
-Function TServiceManager.NametoHash(const ServiceName: TServiceName): Integer;
-// FIXME: check if the non-asm version is fast enough and use it by default if so
-{$IF Defined(CPUX86_64)}
-{$IFDEF FPC}
- {$ASMMODE Intel}
-{$ENDIF}
-asm
- { CL: Counter; RAX: Result; RDX: Current Memory Address }
- Mov RCX, 14
- Mov RDX, ServiceName {Save Address of String that should be "Hashed"}
- Mov RAX, [RDX]
- @FoldLoop: ADD RDX, 4 {jump 4 Byte(32 Bit) to the next tile }
- ADD RAX, [RDX] {Add the Value of the next 4 Byte of the String to the Hash}
- LOOP @FoldLoop {Fold again if there are Chars Left}
-end;
-{$ELSEIF Defined(CPU386) or Defined(CPUI386)}
-{$IFDEF FPC}
- {$ASMMODE Intel}
-{$ENDIF}
-asm
- { CL: Counter; EAX: Result; EDX: Current Memory Address }
- Mov ECX, 14 {Init Counter, Fold 14 Times to get 4 Bytes out of 60}
- Mov EDX, ServiceName {Save Address of String that should be "Hashed"}
- Mov EAX, [EDX]
- @FoldLoop: ADD EDX, 4 {jump 4 Byte(32 Bit) to the next tile }
- ADD EAX, [EDX] {Add the Value of the next 4 Byte of the String to the Hash}
- LOOP @FoldLoop {Fold again if there are Chars Left}
-end;
-{$ELSE}
-var
- i: integer;
- ptr: ^integer;
-begin
- ptr := @ServiceName;
- Result := 0;
- for i := 1 to 14 do
- begin
- Result := Result + ptr^;
- Inc(ptr);
- end;
-end;
-{$IFEND}
-
-
-//------------
-// Function Returns Non Zero if a Service with the given Name Exists, otherwise 0
-//------------
-Function TServiceManager.ServiceExists(const ServiceName: PChar): Integer;
-var
- Name: TServiceName;
- Hash: Integer;
- Cur: PServiceInfo;
- I: Byte;
-begin
- Result := 0;
- // to-do : Write a Metbod (in ASM) to Zero and Add in one turn (faster then this dirty hack ;)
- //Zero Name:
- Name := #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0 + #0;
- //Add Service Name
- Name := String(ServiceName);
- Hash := NametoHash(Name);
-
- //First of all Look for the Service in Cache
- For I := 0 to High(ServiceCache) do
- begin
- If (ServiceCache[I] <> nil) AND (ServiceCache[I].Hash = Hash) then
- begin
- If (ServiceCache[I].Name = Name) then
- begin //Found Service in Cache
- Result := Integer(ServiceCache[I]);
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Found Service in Cache: ''' + ServiceName + '''');
- {$ENDIF}
-
- Break;
- end;
- end;
- end;
-
- If (Result = 0) then
- begin
- Cur := FirstService;
- While (Cur <> nil) do
- begin
- If (Cur.Hash = Hash) then
- begin
- If (Cur.Name = Name) then
- begin //Found the Service
- Result := Integer(Cur);
-
- {$IFDEF DEBUG}
- debugWriteln('ServiceManager: Found Service in List: ''' + ServiceName + '''');
- {$ENDIF}
-
- //Add to Cache
- ServiceCache[NextCacheItem] := Cur;
- NextCacheItem := (NextCacheItem + 1) AND 3;
- Break;
- end;
- end;
-
- Cur := Cur.Next;
- end;
- end;
-end;
-
-end.
diff --git a/unicode/src/base/USingScores.pas b/unicode/src/base/USingScores.pas
index 2d9b1e5e..89896d2d 100644
--- a/unicode/src/base/USingScores.pas
+++ b/unicode/src/base/USingScores.pas
@@ -34,211 +34,211 @@ interface
{$I switches.inc}
uses
- UThemes,
gl,
+ UThemes,
UTexture;
//////////////////////////////////////////////////////////////
// ATTENTION: //
-// 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 //
+// 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 //
//////////////////////////////////////////////////////////////
-//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; //Teh 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; // the 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 - 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
+ // 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
end;
- aScorePosition = array[0..MaxPositions-1] of TScorePosition;
+ aScorePosition = array [0..MaxPositions-1] of TScorePosition;
//-----------
- // TScorePopUp - Record Containing Information about a LineBonus Popup
- // List, Next Item is Saved in Next attribute
+ // TScorePopUp - record containing information about a line bonus 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 RatingBar by Playerindex
- procedure DrawRatingBar(const Index: Integer);
+ // draws the rating bar 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
- //Propertys for Reading Position and Playercount
- property PositionCount: Byte read oPositionCount;
- property PlayerCount: Byte read oPlayerCount;
- property Players: aScorePlayer read aPlayers;
+ // properties 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 Linebonus PopUps
+ // draws scores and line bonus popups
procedure Draw;
end;
-
implementation
-uses SDL,
- SysUtils,
- ULog,
- UGraphic,
- TextGL;
+uses
+ SysUtils,
+ SDL,
+ TextGL,
+ ULog,
+ UGraphic;
{**
- * 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,22 +260,21 @@ 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
@@ -283,48 +282,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;
@@ -332,14 +331,16 @@ 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;
@@ -373,54 +374,55 @@ var I: Integer;
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
- // Player1:
+ // player 1:
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);
- // Player2:
+ // player 2:
AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore);
AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore);
- // Player3:
+ // player 3:
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 textur
+ // limit rating value to 8
+ // a higher value would cause a crash when selecting the bg texture
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;
@@ -429,77 +431,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 not existing player');
+ Log.LogError('TSingScores: Try to add popup for non-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;
@@ -511,40 +513,42 @@ begin
end;
{**
- * 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 each 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;
@@ -558,17 +562,16 @@ 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 Screen or Display on One Screen
+ // split players to both screens or display on one screen
if (Screens = 2) and (MaxPlayersPerScreen < PlayerCount) then
begin
PlC[0] := PlayerCount div 2 + PlayerCount mod 2;
@@ -580,9 +583,8 @@ 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
@@ -592,34 +594,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
@@ -638,64 +640,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: integer;
- 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;
@@ -706,25 +708,25 @@ begin
Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2;
FontSize := Round(Progress * Positions[PIndex].PUFontSize);
- FontOffset := (H - FontSize) / 2;
+ 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);
@@ -735,65 +737,68 @@ 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 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
+ // 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
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
+ // draw popup
- if (Alpha > 0) AND (Players[PopUp.Player].Visible) then
+ 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);
@@ -811,45 +816,46 @@ begin
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- //Set FontStyle and Size
+ // set font style 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 not existing PopUp');
+ Log.LogError('TSingScores: Try to draw a non-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);
@@ -867,50 +873,51 @@ 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, Size: Real;
- Diff: Real;
+ Position: PScorePosition;
+ R, G, B: real;
+ Size, 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 RatingBar
+ // get colors for rating bar
if (Players[index].RBPos <= 0.22) then
begin
R := 1;
@@ -920,7 +927,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
@@ -931,7 +938,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
@@ -942,12 +949,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 RatingBar BG
+ // draw rating bar bg
glColor4f(1, 1, 1, 0.8);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum);
@@ -965,7 +972,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);
@@ -983,7 +990,7 @@ begin
glVertex2f(Size, Position.RBY);
glEnd;
- //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability)
+ // draw rating bar fg (the 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);
@@ -1000,11 +1007,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 852ccfc4..7a996262 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,15 +668,14 @@ 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
@@ -694,7 +693,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
@@ -706,13 +705,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
@@ -723,7 +722,7 @@ end;
procedure TCatSongs.ClickCategoryButton(Index: integer);
var
- Num: integer;
+ Num: integer;
begin
Num := CatSongs.Song[Index].OrderNum;
if Num <> CatNumShow then
@@ -739,7 +738,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
@@ -749,8 +748,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
@@ -761,11 +760,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.
@@ -791,16 +790,16 @@ 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
@@ -838,8 +837,8 @@ begin
fltArtist:
TmpString := Song[I].Artist;
end;
- Song[i].Visible:=True;
- // Look for every Searched Word
+ Song[i].Visible := true;
+ // Look for every searched word
for J := 0 to High(WordArray) do
begin
Song[i].Visible := Song[i].Visible and
@@ -849,7 +848,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 962bd2b0..97f244fe 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 := 0;
- H := 0;
+ W := oldWidth;
+ H := oldHeight;
ScaleW := 1;
ScaleH := 1;
Rot := 0;
diff --git a/unicode/src/base/UThemes.pas b/unicode/src/base/UThemes.pas
index 9bf858ed..3fd77853 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,11 +175,12 @@ type
W: integer;
H: integer;
Z: real;
+ SBGW: integer;
TextSize: integer;
- //SBGW Mod
- SBGW: integer;
+ showArrows:boolean;
+ oneItemOnly:boolean;
Text: string;
ColR, ColG, ColB, Int: real;
@@ -359,6 +360,11 @@ type
PausePopUp: TThemeStatic;
end;
+ TThemeLyricBar = record
+ IndicatorYOffset, UpperX, UpperW, UpperY, UpperH,
+ LowerX, LowerW, LowerY, LowerH : integer;
+ end;
+
TThemeScore = class(TThemeBasic)
TextArtist: TThemeText;
TextTitle: TThemeText;
@@ -723,6 +729,7 @@ type
Level: TThemeLevel;
Song: TThemeSong;
Sing: TThemeSing;
+ LyricBar: TThemeLyricBar;
Score: TThemeScore;
Top5: TThemeTop5;
Options: TThemeOptions;
@@ -1031,9 +1038,19 @@ 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');
@@ -1769,7 +1786,7 @@ begin
ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0);
- ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450);
+ ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400);
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 3f35dffd..83844cb5 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 6039835c..ceb1b7f0 100644
--- a/unicode/src/lib/ffmpeg/avcodec.pas
+++ b/unicode/src/lib/ffmpeg/avcodec.pas
@@ -29,6 +29,11 @@
* 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;
@@ -60,8 +65,8 @@ uses
const
(* Max. supported version by this header *)
LIBAVCODEC_MAX_VERSION_MAJOR = 52;
- LIBAVCODEC_MAX_VERSION_MINOR = 11;
- LIBAVCODEC_MAX_VERSION_RELEASE = 0;
+ LIBAVCODEC_MAX_VERSION_MINOR = 31;
+ LIBAVCODEC_MAX_VERSION_RELEASE = 2;
LIBAVCODEC_MAX_VERSION = (LIBAVCODEC_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVCODEC_MAX_VERSION_MINOR * VERSION_MINOR) +
(LIBAVCODEC_MAX_VERSION_RELEASE * VERSION_RELEASE);
@@ -85,9 +90,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.
@@ -233,6 +238,28 @@ 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,
@@ -308,7 +335,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,
@@ -354,6 +381,15 @@ 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,
@@ -369,11 +405,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;
@@ -407,7 +443,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;
@@ -434,13 +470,28 @@ 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
- CH_FRONT_LEFT_OF_CENTER or CH_FRONT_RIGHT_OF_CENTER);
+ 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_LAYOUT_STEREO_DOWNMIX = (CH_STEREO_LEFT or CH_STEREO_RIGHT);
@@ -482,20 +533,76 @@ 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
+ * 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
);
+ 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;
@@ -655,8 +762,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;
@@ -678,7 +785,311 @@ 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
@@ -724,7 +1135,7 @@ type
* - decoding: Set by libavcodec.
*)
pts: cint64;
- (**\
+ (**
* picture number in bitstream order
* - encoding: set by
* - decoding: Set by libavcodec.
@@ -753,6 +1164,7 @@ 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)).
*)
@@ -877,7 +1289,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
@@ -886,8 +1298,20 @@ 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.
@@ -897,7 +1321,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.
@@ -913,7 +1337,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.
@@ -928,234 +1352,73 @@ type
*)
rc_min_vbv_overflow_use: cfloat;
{$IFEND}
- end;
-
-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
- 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;}
+ {$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;
-type
- PAVClass = ^TAVClass; {const}
- PAVCodecContext = ^TAVCodecContext;
+ (**
+ * Color Transfer Characteristic.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ *)
+ color_trc: TAVColorTransferCharacteristic;
- PAVCodec = ^TAVCodec;
+ (**
+ * YUV colorspace type.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ *)
+ colorspace: TAVColorSpace;
- // 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;
+ (**
+ * MPEG vs JPEG YUV range.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ *)
+ color_range: TAVColorRange;
- 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;
+ (**
+ * This defines the location of chroma samples.
+ * - encoding: Set by user
+ * - decoding: Set by libavcodec
+ *)
+ chroma_sample_location: TAVChromaLocation;
+ {$IFEND}
end;
(**
@@ -1273,6 +1536,13 @@ 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
@@ -1301,7 +1571,9 @@ 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
@@ -1490,6 +1762,9 @@ 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.
*)
@@ -1505,7 +1780,8 @@ type
release_buffer: procedure (c: PAVCodecContext; pic: PAVFrame); cdecl;
(**
- * If 1 the stream has a 1 frame delay during decoding.
+ * Size of the frame reordering buffer in the decoder.
+ * For MPEG-2 it is 1 IPB or 0 low delay IP.
* - encoding: Set by libavcodec.
* - decoding: Set by libavcodec.
*)
@@ -2012,6 +2288,9 @@ 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
*)
@@ -2465,6 +2744,15 @@ 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;
(**
@@ -2479,7 +2767,11 @@ 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_*
@@ -2495,8 +2787,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 \p name.
- * You \e should use the NULL_IF_CONFIG_SMALL() macro to define it.
+ * 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.
*)
long_name: {const} PAnsiChar;
{$IFEND}
@@ -2511,6 +2803,105 @@ 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
@@ -2594,9 +2985,69 @@ type
{$IFEND}
end;
+{$IF LIBAVCODEC_VERSION >= 52025000} // 52.25.0
+{ packet functions }
-(* resample.c *)
+(**
+ * @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;
@@ -2611,15 +3062,44 @@ 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;
@@ -2627,7 +3107,6 @@ 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 ! *)
@@ -2660,7 +3139,6 @@ procedure img_resample (s: PImgReSampleContext; output: PAVPicture; input: {cons
*)
procedure img_resample_close (s: PImgReSampleContext);
cdecl; external av__codec; deprecated;
-
{$IFEND}
(**
@@ -2692,6 +3170,7 @@ 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
@@ -2712,11 +3191,14 @@ 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
+ * @return Image data size in bytes or -1 on error (e.g. too large dimensions).
*)
function avpicture_get_size (pix_fmt: TAVPixelFormat; width: cint; height: cint): cint;
cdecl; external av__codec;
@@ -2724,12 +3206,34 @@ 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;
@@ -2773,7 +3277,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
- * \p pix_fmt_mask parameter.
+ * pix_fmt_mask parameter.
*
* @code
* src_pix_fmt = PIX_FMT_YUV420P;
@@ -2791,10 +3295,14 @@ 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;
-{$ELSE}
+{$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;
+ cdecl; external av__codec;
{$IFEND}
{$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0
@@ -2808,8 +3316,13 @@ 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
@@ -2822,7 +3335,8 @@ 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
@@ -2838,8 +3352,11 @@ 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 *}
@@ -2852,6 +3369,11 @@ 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}
@@ -2871,20 +3393,27 @@ function avcodec_build(): cuint;
(**
* Initializes libavcodec.
*
- * @warning This function \e must be called before any other libavcodec
+ * @warning This function must be called before any other libavcodec
* function.
*)
procedure avcodec_init();
cdecl; external av__codec;
(**
- * Register the codec \p codec and initialize libavcodec.
+ * Register the codec 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.
*
@@ -3050,125 +3579,189 @@ 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;
+ cdecl; external av__codec; {deprecated;}
{$IFEND}
+{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53}
{$IF LIBAVCODEC_VERSION >= 51030000} // 51.30.0
(**
- * 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.
+ * 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.
*
- * @warning You \e must set \p frame_size_ptr to the allocated size of the
- * output buffer before calling avcodec_decode_audio2().
+ * @warning You must set frame_size_ptr to the allocated size of the
+ * output buffer before calling avcodec_decode_audio3().
*
- * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
+ * @warning The input buffer must be 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 \p buf should be set to 0 to ensure that
+ * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that
* no overreading happens for damaged MPEG streams.
*
- * @note You might have to align the input buffer \p buf and output buffer \p
+ * @note You might have to align the input buffer avpkt->data and output buffer
* 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, 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.
+ * * 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).
*
* @note Some codecs have a delay between input and output, these need to be
- * feeded with buf=NULL, buf_size=0 at the end to return the remaining frames.
+ * feeded with avpkt->data=NULL, avpkt->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] buf the input buffer
- * @param[in] buf_size the input 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.
* @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;
+function avcodec_decode_audio3(avctx: PAVCodecContext; samples: PSmallint;
var frame_size_ptr: cint;
- buf: {const} PByteArray; buf_size: cint): cint;
+ avpkt: PAVPacket): cint;
cdecl; external av__codec;
{$IFEND}
+{$IF LIBAVCODEC_MAX_VERSION_MAJOR < 53}
(**
- * 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.
+ * Decodes a video frame from buf into picture.
+ * Wrapper function which calls avcodec_decode_video2.
*
- * @warning The input buffer must be \c FF_INPUT_BUFFER_PADDING_SIZE larger than
+ * @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
* 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 \p buf should be set to 0 to ensure that
+ * @warning The end of the input buffer 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 \p buf and output buffer \p
- * samples. The alignment requirements depend on the CPU: on some CPUs it isn't
+ * @note You might have to align the input buffer avpkt->data.
+ * 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, 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.
+ * it will work but it will have an impact on performance.
+ *
+ * In practice, avpkt->data should have 4 byte alignment at minimum.
*
* @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] 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,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;
+function avcodec_decode_video2(avctx: PAVCodecContext; picture: PAVFrame;
var got_picture_ptr: cint;
- buf: {const} PByteArray; buf_size: cint): cint;
+ avpkt: PAVPacket): 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 \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.
+ * Encodes an audio frame from samples into buf.
*
- * @note The output buffer should be at least \c FF_MIN_BUFFER_SIZE bytes large.
+ * @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.
*
* @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 \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.
+ * 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.
* @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.
*)
@@ -3177,12 +3770,9 @@ function avcodec_encode_audio(avctx: PAVCodecContext; buf: PByte;
cdecl; external av__codec;
(**
- * 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.
+ * Encodes a video frame from pict into buf.
+ * The input picture should be
+ * stored using a specific format, namely avctx.pix_fmt.
*
* @param avctx the codec context
* @param[out] buf the output buffer for the bitstream of encoded frame
@@ -3208,6 +3798,7 @@ function avcodec_close(avctx: PAVCodecContext): cint;
* functions.
*
* @see register_avcodec
+ * @see avcodec_register
* @see av_register_codec_parser
* @see av_register_bitstream_filter
*)
@@ -3226,7 +3817,7 @@ procedure avcodec_default_free_buffers(s: PAVCodecContext);
(* misc useful functions *)
(**
- * Returns a single letter to describe the given picture type \p pict_type.
+ * Returns a single letter to describe the given picture type pict_type.
*
* @param[in] pict_type the picture type
* @return A single character representing the picture type.
@@ -3271,6 +3862,15 @@ 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 *)
@@ -3293,6 +3893,94 @@ 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
@@ -3327,12 +4015,60 @@ 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;
+ 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}
+
function av_parser_change(s: PAVCodecParserContext;
avctx: PAVCodecContext;
poutbuf: PPointer; poutbuf_size: PCint;
@@ -3395,6 +4131,22 @@ 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 *)
@@ -3407,7 +4159,7 @@ procedure av_fast_realloc(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;
(**
@@ -3433,22 +4185,49 @@ procedure av_realloc_static(ptr: pointer; size: cuint);
(**
* Copy image 'src' to 'dst'.
*)
-procedure av_picture_copy(dst: PAVPicture; src: {const} PAVPicture;
- pix_fmt: cint; width: cint; height: cint);
+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);
cdecl; external av__codec;
(**
* Crop image top and left side.
*)
-function av_picture_crop(dst: PAVPicture; src: {const} PAVPicture;
- pix_fmt: cint; top_band: cint; left_band: cint): cint;
+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;
cdecl; external av__codec;
(**
* Pad image.
*)
-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;
+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;
cdecl; external av__codec;
{$IFEND}
@@ -3481,7 +4260,7 @@ function av_xiphlacing(s: PByte; v: cuint): cuint;
{$IF LIBAVCODEC_VERSION >= 51041000} // 51.41.0
(**
- * Parses \p str and put in \p width_ptr and \p height_ptr the detected values.
+ * Parses str and put in width_ptr and 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
@@ -3495,11 +4274,11 @@ function av_parse_video_frame_size(width_ptr: PCint; height_ptr: PCint; str: {co
cdecl; external av__codec;
(**
- * Parses \p str and put in \p frame_rate the detected values.
+ * Parses str and put in 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_nom>/<frame_rate_den>, a float number or a valid video rate abbreviation
+ * <frame_rate_num>/<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
*)
@@ -3518,11 +4297,13 @@ 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.
@@ -3559,11 +4340,76 @@ 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. *}
+ 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}
// 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 62df8a83..0ec2c118 100644
--- a/unicode/src/lib/ffmpeg/avformat.pas
+++ b/unicode/src/lib/ffmpeg/avformat.pas
@@ -29,6 +29,11 @@
* 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;
@@ -60,7 +65,7 @@ uses
const
(* Max. supported version by this header *)
LIBAVFORMAT_MAX_VERSION_MAJOR = 52;
- LIBAVFORMAT_MAX_VERSION_MINOR = 25;
+ LIBAVFORMAT_MAX_VERSION_MINOR = 34;
LIBAVFORMAT_MAX_VERSION_RELEASE = 0;
LIBAVFORMAT_MAX_VERSION = (LIBAVFORMAT_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVFORMAT_MAX_VERSION_MINOR * VERSION_MINOR) +
@@ -92,13 +97,11 @@ 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:
@@ -111,7 +114,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 3-letter language code.
+ * with a dash character ('-') and the ISO 639-2/B 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.
@@ -130,53 +133,51 @@ 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 if success otherwise error code that is <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 on success otherwise an error code <0
*)
function av_metadata_set(var pm: PAVMetadata; key: {const} PAnsiChar; value: {const} PAnsiChar): cint;
cdecl; external av__format;
(**
- * Free all the memory allocated for an AVMetadata struct.
+ * Frees 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 time stamp in time_base units.
- * This is the time at which the decompressed packet will be presented
- * to the user.
+ * Presentation timestamp in 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 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, these timestamps
+ * 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 time stamp in time_base units.
- * This is the time at which the packet is decompressed.
+ * Decompression timestamp in 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;
@@ -245,6 +246,7 @@ 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
@@ -257,6 +259,7 @@ 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.
@@ -270,6 +273,7 @@ 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 *)
@@ -278,7 +282,6 @@ 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
@@ -297,7 +300,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.
@@ -310,6 +313,9 @@ 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;
@@ -320,7 +326,7 @@ const
AVFMT_NOOUTPUTLOOP = -1;
AVFMT_INFINITEOUTPUTLOOP = 0;
- AVFMT_FLAG_GENPTS = $0001; ///< Generate pts if missing even if it requires parsing future frames.
+ AVFMT_FLAG_GENPTS = $0001; ///< Generate missing pts 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.
@@ -339,7 +345,11 @@ const
AV_DISPOSITION_KARAOKE = $0020;
// used by TAVFormatContext.debug
- FF_FDEBUG_TS = 0001;
+ FF_FDEBUG_TS = 0001;
+
+ {$IF LIBAVFORMAT_VERSION >= 52034000} // > 52.34.0
+ MAX_PROBE_PACKETS = 100;
+ {$IFEND}
type
PPAVCodecTag = ^PAVCodecTag;
@@ -367,12 +377,29 @@ 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}
@@ -415,13 +442,13 @@ type
name: PAnsiChar;
(**
* Descriptive name for the format, meant to be more human-readable
- * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
+ * than name. You 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 *)
@@ -439,7 +466,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 CODEC_ID_NONE terminated.
+ * choice first". The arrays are all terminated by CODEC_ID_NONE.
*)
codec_tag: {const} PPAVCodecTag;
{$IFEND}
@@ -448,6 +475,10 @@ 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;
@@ -456,14 +487,14 @@ type
name: PAnsiChar;
(**
* Descriptive name for the format, meant to be more human-readable
- * than \p name. You \e should use the NULL_IF_CONFIG_SMALL() macro
+ * than name. You 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 by this format.
+ * Tell if a given file has a chance of being parsed as 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.
*)
@@ -475,21 +506,28 @@ 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. *)
+ 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 *)
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
@@ -517,6 +555,25 @@ 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;
@@ -551,11 +608,11 @@ type
id: cint; (**< format-specific stream ID *)
codec: PAVCodecContext; (**< codec context *)
(**
- * Real base frame rate of the stream.
- * This is the lowest frame rate with which all timestamps can be
+ * Real base framerate of the stream.
+ * This is the lowest framerate with which all timestamps can be
* represented accurately (it is the least common multiple of all
- * 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
+ * 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
* approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
*)
r_frame_rate: TAVRational;
@@ -572,7 +629,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/frame rate and timestamp increments should be 1.
+ * time base should be 1/framerate and timestamp increments should be 1.
*)
time_base: TAVRational;
pts_wrap_bits: cint; (* number of bits in pts (used for wrapping control) *)
@@ -599,7 +656,9 @@ type
*)
duration: cint64;
- language: array [0..3] of PAnsiChar; (* ISO 639 3-letter language code (empty string if undefined) *)
+ {$IF LIBAVFORMAT_VERSION_MAJOR < 53}
+ language: array [0..3] of PAnsiChar; (* ISO 639-2/B 3-letter language code (empty string if undefined) *)
+ {$IFEND}
(* av_read_frame() support *)
need_parsing: TAVStreamParseType;
@@ -620,7 +679,7 @@ type
unused: array [0..4] of cint64;
{$IFEND}
- {$IF LIBAVFORMAT_VERSION >= 52006000} // 52.6.0
+ {$IF (LIBAVFORMAT_VERSION >= 52006000) and (LIBAVFORMAT_VERSION_MAJOR < 53)} // 52.6.0 - 53.0.0
filename: PAnsiChar; (**< source filename of the stream *)
{$IFEND}
@@ -653,6 +712,25 @@ 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;
(**
@@ -663,7 +741,7 @@ type
* sizeof(AVFormatContext) must not be used outside libav*.
*)
TAVFormatContext = record
- av_class: PAVClass; (**< Set by av_alloc_format_context. *)
+ av_class: PAVClass; (**< Set by avformat_alloc_context. *)
(* Can only be iformat or oformat, not both at the same time. *)
iformat: PAVInputFormat;
oformat: PAVOutputFormat;
@@ -680,6 +758,7 @@ 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;
@@ -688,6 +767,7 @@ 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). *)
@@ -735,7 +815,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}
@@ -775,8 +855,8 @@ type
{$IF LIBAVFORMAT_VERSION >= 52004000} // 52.4.0
(**
- * 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
+ * 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
* 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
@@ -833,8 +913,10 @@ 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
@@ -908,8 +990,18 @@ 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}
@@ -917,8 +1009,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);
@@ -1006,7 +1098,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 register_protocol()
+ * @see av_register_protocol()
*)
procedure av_register_all();
cdecl; external av__format;
@@ -1062,18 +1154,28 @@ 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 frame rate in case of MPEG-2 repeat
+ * function also computes the real framerate 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.
@@ -1111,7 +1213,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.timebase units (and guessed if the format cannot
+ * values in AVStream.time_base 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.
@@ -1122,7 +1224,7 @@ function av_read_frame(s: PAVFormatContext; var pkt: TAVPacket): cint;
cdecl; external av__format;
(**
- * Seek to the key frame at timestamp.
+ * Seek to the keyframe at timestamp.
* 'timestamp' in 'stream_index'.
* @param stream_index If stream_index is (-1), a default
* stream is selected, and timestamp is automatically converted
@@ -1136,15 +1238,51 @@ 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
(**
- * Start playing a network based stream (e.g. RTSP stream) at the
+ * 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
* 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.
*)
@@ -1239,7 +1377,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.
@@ -1337,7 +1475,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
@@ -1355,7 +1493,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 calling av_free_packet()
+ * function, so they cannot be used after it. Note that calling av_free_packet()
* on them is still safe.
*
* @param s media file handle
@@ -1370,6 +1508,24 @@ 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.
@@ -1396,7 +1552,7 @@ function parse_image_size(width_ptr: PCint; height_ptr: PCint;
{$IF LIBAVFORMAT_VERSION_MAJOR < 53}
(**
- * Converts frame rate from string to a fraction.
+ * Converts framerate from a string to a fraction.
* @deprecated Use av_parse_video_frame_rate instead.
*)
function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint;
@@ -1405,7 +1561,7 @@ function parse_frame_rate(frame_rate: PCint; frame_rate_base: PCint;
{$IFEND}
(**
- * Parses \p datestr and returns a corresponding number of microseconds.
+ * Parses datestr and returns a corresponding number of microseconds.
* @param datestr String representing a date or a duration.
* - If a date the syntax is:
* @code
@@ -1416,7 +1572,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 \p datestr cannot be
+ * the time of the parsed date or INT64_MIN if datestr cannot be
* successfully parsed.
* - If a duration the syntax is:
* @code
@@ -1424,10 +1580,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 \p datestr cannot be
+ * with the specified duration or INT64_MIN if datestr cannot be
* successfully parsed.
- * @param duration Flag which tells how to interpret \p datestr, if
- * not zero \p datestr is interpreted as a duration, otherwise as a
+ * @param duration Flag which tells how to interpret datestr, if
+ * not zero datestr is interpreted as a duration, otherwise as a
* date.
*)
function parse_date(datestr: PAnsiChar; duration: cint): cint64;
@@ -1444,7 +1600,11 @@ 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);
@@ -1460,7 +1620,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 number.
+ * Returns in 'buf' the path with '%d' replaced by a number.
*
* Also handles the '%0nd' format where 'n' is the total number
* of digits and '%%'.
@@ -1526,10 +1686,12 @@ 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 33778206..dc0a330b 100644
--- a/unicode/src/lib/ffmpeg/avio.pas
+++ b/unicode/src/lib/ffmpeg/avio.pas
@@ -27,7 +27,12 @@
(*
* Conversion of libavformat/avio.h
- * revision 16100, Sat Dec 13 13:39:13 2008 UTC
+ * 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.
*)
unit avio;
@@ -103,6 +108,7 @@ 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;
@@ -180,6 +186,16 @@ 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
@@ -240,19 +256,34 @@ 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;
@@ -521,7 +552,7 @@ function ff_crc04C11DB7_update(checksum: culong; buf: {const} PByteArray;
{$IFEND}
function get_checksum(s: PByteIOContext): culong;
cdecl; external av__format;
-procedure init_checksum(s: PByteIOContext;
+procedure init_gsum(s: PByteIOContext;
update_checksum: pointer;
checksum: culong);
cdecl; external av__format;
@@ -531,9 +562,11 @@ 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 6de35f1b..6a93ea12 100644
--- a/unicode/src/lib/ffmpeg/avutil.pas
+++ b/unicode/src/lib/ffmpeg/avutil.pas
@@ -29,14 +29,21 @@
*
* 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;
@@ -62,8 +69,8 @@ uses
const
(* Max. supported version by this header *)
- LIBAVUTIL_MAX_VERSION_MAJOR = 49;
- LIBAVUTIL_MAX_VERSION_MINOR = 14;
+ LIBAVUTIL_MAX_VERSION_MAJOR = 50;
+ LIBAVUTIL_MAX_VERSION_MINOR = 3;
LIBAVUTIL_MAX_VERSION_RELEASE = 0;
LIBAVUTIL_MAX_VERSION = (LIBAVUTIL_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBAVUTIL_MAX_VERSION_MINOR * VERSION_MINOR) +
@@ -112,6 +119,14 @@ 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;
@@ -123,11 +138,15 @@ 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
@@ -135,13 +154,17 @@ 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(xvmc_render.h)
+ PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing
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)
@@ -150,10 +173,15 @@ 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)
@@ -164,23 +192,74 @@ 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}
- 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;
+ {$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}
{$else}
- 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 <= 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}
{$IF LIBAVUTIL_VERSION_MAJOR < 50} // 50.0.0
PIX_FMT_UYVY411 = PIX_FMT_UYYVYY411;
@@ -188,40 +267,41 @@ const
PIX_FMT_YUV422 = PIX_FMT_YUYV422;
{$IFEND}
-(* common.h *)
+(* libavutil/common.h *) // until now MKTAG is all from common.h KMS 9/6/2009
-function MKTAG(a,b,c,d: AnsiChar): integer;
+function MKTAG(a, b, c, d: AnsiChar): integer;
-(* mem.h *)
+(* libavutil/mem.h *)
+(* memory handling functions *)
(**
- * Allocate a block of \p size bytes with alignment suitable for all
+ * Allocates a block of 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 it cannot allocate
- * it.
+ * @return Pointer to the allocated block, NULL if the block cannot
+ * be allocated.
* @see av_mallocz()
*)
function av_malloc(size: cuint): pointer;
cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)}
(**
- * 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.
+ * 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.
* @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 it cannot
- * reallocate or the function is used to free the memory block.
+ * @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.
* @see av_fast_realloc()
*)
function av_realloc(ptr: pointer; size: cuint): pointer;
cdecl; external av__util; {av_alloc_size(2)}
(**
- * Free a memory block which has been allocated with av_malloc(z)() or
+ * Frees 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.
@@ -232,29 +312,28 @@ procedure av_free(ptr: pointer);
cdecl; external av__util;
(**
- * Allocate a block of \p size bytes with alignment suitable for all
+ * Allocates a block of size bytes with alignment suitable for all
* memory accesses (including vectors if available on the CPU) and
- * set to zeroes all the bytes of the block.
+ * 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 allocate
- * it.
+ * @return Pointer to the allocated block, NULL if it cannot be allocated.
* @see av_malloc()
*)
function av_mallocz(size: cuint): pointer;
cdecl; external av__util; {av_malloc_attrib av_alloc_size(1)}
(**
- * Duplicate the string \p s.
- * @param s String to be duplicated.
+ * Duplicates the string s.
+ * @param s string to be duplicated.
* @return Pointer to a newly allocated string containing a
- * copy of \p s or NULL if it cannot be allocated.
+ * copy of \p s or NULL if the string cannot be allocated.
*)
function av_strdup({const} s: PAnsiChar): PAnsiChar;
cdecl; external av__util; {av_malloc_attrib}
(**
- * Free a memory block which has been allocated with av_malloc(z)() or
- * av_realloc() and set to NULL the pointer to it.
+ * Frees a memory block which has been allocated with av_malloc(z)() or
+ * av_realloc() and set the pointer pointing to it to NULL.
* @param ptr Pointer to the pointer to the memory block which should
* be freed.
* @see av_free()
@@ -262,7 +341,7 @@ function av_strdup({const} s: PAnsiChar): PAnsiChar;
procedure av_freep (ptr: pointer);
cdecl; external av__util;
-(* log.h *)
+(* libavutil/log.h *)
const
{$IF LIBAVUTIL_VERSION_MAJOR < 50}
@@ -277,26 +356,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
- * like no header in a format which depends on it or a combination
- * of parameters which are not allowed
+ * 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.
*)
AV_LOG_FATAL = 8;
(**
- * something went wrong and cannot losslessly be recovered
- * but not all future data is affected
+ * Something went wrong and cannot losslessly be recovered.
+ * However, not all future data is affected.
*)
AV_LOG_ERROR = 16;
(**
- * something somehow does not look correct / something which may or may not
- * lead to some problems like use of -vstrict -2
+ * Something somehow does not look correct. This may or may not
+ * lead to problems. An example would be the use of '-vstrict -2'.
*)
AV_LOG_WARNING = 24;
@@ -304,7 +383,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}
@@ -317,7 +396,9 @@ procedure av_log_set_level(level: cint);
implementation
-function MKTAG(a,b,c,d: AnsiChar): integer;
+(* libavutil/common.h *)
+
+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 fb57ccea..92ee0a5e 100644
--- a/unicode/src/lib/ffmpeg/mathematics.pas
+++ b/unicode/src/lib/ffmpeg/mathematics.pas
@@ -27,6 +27,9 @@
(*
* 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;
@@ -55,11 +58,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
@@ -90,4 +93,3 @@ 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 833dc247..a2e2cce9 100644
--- a/unicode/src/lib/ffmpeg/opt.pas
+++ b/unicode/src/lib/ffmpeg/opt.pas
@@ -28,6 +28,9 @@
(*
* 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;
@@ -109,8 +112,8 @@ type
{$IF LIBAVCODEC_VERSION >= 51039000} // 51.39.0
(**
- * 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,
+ * Looks for an option in obj. Looks only for the options which
+ * have the flags set as specified in mask and 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
@@ -135,7 +138,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 \p val is not
+ * NULL if no matching AVOption exists, or if the value val is not
* valid
* @see av_set_string3()
*)
@@ -167,8 +170,11 @@ 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, an AVERROR* error code if no
- * matching option exists, or if the value \p val is not valid
+ * @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
*)
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 6762aa26..b940009d 100644
--- a/unicode/src/lib/ffmpeg/rational.pas
+++ b/unicode/src/lib/ffmpeg/rational.pas
@@ -28,6 +28,9 @@
(*
* 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;
@@ -135,22 +138,20 @@ 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 \p q than \p q2, -1 if \p q2 is nearer
- * than \p q1, 0 if they have the same distance.
+ * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer
+ * than 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 \p q_list to \p q.
+ * Finds the nearest value in q_list to 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/src/MacOSX/MacOSXReadMe.txt b/unicode/src/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt
deleted file mode 100644
index c2f5826a..00000000
--- a/unicode/src/lib/ffmpeg/src/MacOSX/MacOSXReadMe.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-If you are using fink to install ffmpeg and friends,
-you can skip the rest of this notes.
-
-How to download an build ffmpeg for UltraStar Deluxe on Mac OS X:
-
-1. Open a terminal.
-
-2. cd into the Game/Code/lib/ffmpeg/src/MacOSX directory
-
-3. Run the following command:
-
-svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
-
-4. The compile ffmpeg. I made a script for this:
-
-./build_ffmpeg.sh
-
-5. On OS X you have to patch the the dylibs. Run the following
- script. It patches the dylibs and copies them to the
- lib/ffmpeg dir:
-
-./copy_and_patch_dylibs.sh
-
-You're done.
diff --git a/unicode/src/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh b/unicode/src/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh
deleted file mode 100755
index bcb3ca1e..00000000
--- a/unicode/src/lib/ffmpeg/src/MacOSX/build_ffmpeg.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/bash
-
-cd ffmpeg
-./configure --enable-shared --disable-static --disable-mmx
-make
-
diff --git a/unicode/src/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh b/unicode/src/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh
deleted file mode 100755
index 064d2ecc..00000000
--- a/unicode/src/lib/ffmpeg/src/MacOSX/copy_and_patch_dylibs.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-# Copy dylibs:
-cp ffmpeg/libavcodec/libavcodec.51.dylib ../../libavcodec.dylib
-cp ffmpeg/libavformat/libavformat.52.dylib ../../libavformat.dylib
-cp ffmpeg/libavutil/libavutil.49.dylib ../../libavutil.dylib
-
-# Patching libavcodec:
-install_name_tool -id @executable_path/libavcodec.dylib ../../libavcodec.dylib
-install_name_tool -change /usr/local/lib/libavutil.dylib @executable_path/libavutil.dylib ../../libavcodec.dylib
-
-# Patching libavformat:
-install_name_tool -id @executable_path/libavformat.dylib ../../libavformat.dylib
-install_name_tool -change /usr/local/lib/libavutil.dylib @executable_path/libavutil.dylib ../../libavformat.dylib
-install_name_tool -change /usr/local/lib/libavcodec.dylib @executable_path/libavcodec.dylib ../../libavformat.dylib
-
-# Patching libavcodec:
-install_name_tool -id @executable_path/libavutil.dylib ../../libavutil.dylib
-
-# Printing result:
-otool -L ../../libavutil.dylib
-otool -L ../../libavcodec.dylib
-otool -L ../../libavformat.dylib \ No newline at end of file
diff --git a/unicode/src/lib/ffmpeg/swscale.pas b/unicode/src/lib/ffmpeg/swscale.pas
index 965659d9..c0aabf45 100644
--- a/unicode/src/lib/ffmpeg/swscale.pas
+++ b/unicode/src/lib/ffmpeg/swscale.pas
@@ -45,12 +45,13 @@ interface
uses
ctypes,
avutil,
+ avcodec,
UConfig;
const
(* Max. supported version by this header *)
LIBSWSCALE_MAX_VERSION_MAJOR = 0;
- LIBSWSCALE_MAX_VERSION_MINOR = 6;
+ LIBSWSCALE_MAX_VERSION_MINOR = 7;
LIBSWSCALE_MAX_VERSION_RELEASE = 1;
LIBSWSCALE_MAX_VERSION = (LIBSWSCALE_MAX_VERSION_MAJOR * VERSION_MAJOR) +
(LIBSWSCALE_MAX_VERSION_MINOR * VERSION_MINOR) +
@@ -78,7 +79,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;
@@ -98,10 +99,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;
@@ -123,15 +124,14 @@ 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;
- length: cint;
+ coeff: PCdouble; // pointer to the list of coefficients
+ length: cint; // number of coefficients in the vector
end;
// vectors can be shared
@@ -148,63 +148,179 @@ 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;
-function sws_scale(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint; srcSliceH: cint;
- dst: PPCuint8Array; dstStride: PCintArray): cint;
+
+(**
+ * 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;
cdecl; external sw__scale;
-function sws_scale_ordered(context: PSwsContext; src: PPCuint8Array; srcStride: PCintArray; srcSliceY: cint;
- srcSliceH: cint; dst: PPCuint8Array; dstStride: PCintArray): cint;
+
+{$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;
cdecl; external sw__scale; deprecated;
+{$IFEND}
-function sws_setColorspaceDetails(c: PSwsContext; inv_table: PQuadCintArray; srcRange: cint; table: PQuadCintArray; dstRange: cint;
+(**
+ * @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;
brightness: cint; contrast: cint; saturation: cint): cint;
cdecl; external sw__scale;
-function sws_getColorspaceDetails(c: PSwsContext; var inv_table: PQuadCintArray; var srcRange: cint; var table: PQuadCintArray; var dstRange: cint;
+
+(**
+ * @return -1 if not supported
+ *)
+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; lumaSarpen: cfloat; chromaSharpen: cfloat; chromaHShift: cfloat;
- chromaVShift: cfloat; verbose: cint): PSwsFilter;
+function sws_getDefaultFilter(lumaGBlur: cfloat; chromaGBlur: cfloat;
+ lumaSharpen: 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: cint;
- dstW: cint; dstH: cint; dstFormat: cint; flags: cint;
- srcFilter: PSwsFilter; dstFilter: PSwsFilter; param: PCdouble): PSwsContext;
+ srcW: cint; srcH: cint; srcFormat: TAVPixelFormat;
+ dstW: cint; dstH: cint; dstFormat: TAVPixelFormat;
+ 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 2d221f40..97d8a8df 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(
- CodecCtx^.channels,
+ byte(CodecCtx^.channels),
CodecCtx^.sample_rate,
SampleFormat
);
-
PacketQueue := TPacketQueue.Create();
// finally start the decode thread
@@ -446,7 +446,9 @@ end;
function TFFmpegDecodeStream.GetLength(): real;
begin
- // do not forget to consider the start_time value here
+ // 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.
Result := (FormatCtx^.start_time + FormatCtx^.duration) / AV_TIME_BASE;
end;
@@ -643,7 +645,6 @@ 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 cf292c45..ad6c3818 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: Cardinal; inputDevice: Pointer): boolean; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF}
+ len: integer; 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 53080a03..31d2882b 100644
--- a/unicode/src/media/UAudioInput_Portaudio.pas
+++ b/unicode/src/media/UAudioInput_Portaudio.pas
@@ -95,7 +95,6 @@ var
Error: TPaError;
inputParams: TPaStreamParameters;
deviceInfo: PPaDeviceInfo;
- SourceIndex: integer;
begin
Result := false;
@@ -291,8 +290,6 @@ 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 c8da6bcd..c87e461d 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: cardinal;
+ SampleBufferPos: integer;
SourceBuffer: PByteArray;
SourceBufferSize: integer;
@@ -564,9 +564,8 @@ var
ConversionOutputSize: integer; // max. number of converted data (= buffer size)
ConversionOutputCount: integer; // actual number of converted data
SourceSize: integer;
- RequestedSourceSize: integer;
NeededSampleBufferSize: integer;
- BytesNeeded, BytesAvail: integer;
+ BytesNeeded: integer;
SourceFormatInfo, OutputFormatInfo: TAudioFormatInfo;
SourceFrameSize, OutputFrameSize: integer;
SkipOutputCount: integer; // number of output-data bytes to skip
@@ -574,7 +573,6 @@ 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 35f8ab4d..f55690b2 100644
--- a/unicode/src/media/UVideo.pas
+++ b/unicode/src/media/UVideo.pas
@@ -697,6 +697,12 @@ 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 3e653183..f2eb2ced 100644
--- a/unicode/src/menu/UDisplay.pas
+++ b/unicode/src/menu/UDisplay.pas
@@ -45,43 +45,71 @@ 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;
+ FadeTex: array[1..2] of GLuint;
+
+ FPSCounter: cardinal;
+ LastFPS: cardinal;
+ NextFPSSwap: cardinal;
- FPSCounter : Cardinal;
- LastFPS : Cardinal;
- NextFPSSwap : Cardinal;
+ OSD_LastError: string;
- OSD_LastError : String;
+ { 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;
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;
+ 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;
end;
var
- Display: TDisplay;
+ 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
implementation
@@ -104,15 +132,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);
@@ -125,6 +153,15 @@ 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;
@@ -133,14 +170,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
@@ -166,12 +203,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;
@@ -188,16 +225,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
@@ -275,7 +312,7 @@ begin
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
end
- // blackscreen hack
+// blackscreen hack
else if not BlackScreen then
begin
NextScreen.OnShow;
@@ -286,7 +323,7 @@ begin
// fade out complete...
FadeState := 0;
CurrentScreen.onHide;
- CurrentScreen.ShowFinish := False;
+ CurrentScreen.ShowFinish := false;
CurrentScreen := NextScreen;
NextScreen := nil;
if not BlackScreen then
@@ -296,16 +333,172 @@ 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;
@@ -318,7 +511,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;
@@ -332,9 +525,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);
@@ -347,8 +540,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))
@@ -360,12 +553,13 @@ 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);
@@ -377,13 +571,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
@@ -394,17 +588,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 6d9fba96..7cdaef36 100644
--- a/unicode/src/menu/UMenu.pas
+++ b/unicode/src/menu/UMenu.pas
@@ -34,19 +34,20 @@ interface
{$I switches.inc}
uses
- gl,
SysUtils,
- UTexture,
- UMenuStatic,
- UMenuText,
- UMenuButton,
- UMenuSelectSlide,
- UMenuInteract,
+ Math,
+ gl,
+ SDL,
UMenuBackground,
- UThemes,
+ UMenuButton,
UMenuButtonCollection,
- Math,
- UMusic;
+ UMenuInteract,
+ UMenuSelectSlide,
+ UMenuStatic,
+ UMenuText,
+ UMusic,
+ UTexture,
+ UThemes;
type
{ Int16 = SmallInt;}
@@ -54,15 +55,15 @@ type
PMenu = ^TMenu;
TMenu = class
protected
- Background: TMenuBackground;
+ Background: TMenuBackground;
+
+ Interactions: array of TInteract;
+ SelInteraction: integer;
- Interactions: array of TInteract;
- SelInteraction: integer;
+ ButtonPos: integer;
+ Button: array of TButton;
- ButtonPos: integer;
- Button: array of TButton;
-
- SelectsS: array of TSelectSlide;
+ SelectsS: array of TSelectSlide;
ButtonCollection: array of TButtonCollection;
public
Text: array of TText;
@@ -72,6 +73,7 @@ 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;
@@ -80,10 +82,10 @@ type
// interaction
procedure AddInteraction(Typ, Num: integer);
- procedure SetInteraction(Num: integer);
+ procedure SetInteraction(Num: integer); virtual;
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);
@@ -109,7 +111,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;
@@ -143,9 +145,10 @@ type
function DrawFG: boolean; virtual;
function Draw: boolean; virtual;
function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown : boolean): boolean; virtual;
- // 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;
+ 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;
procedure onShow; virtual;
procedure onShowFinish; virtual;
procedure onHide; virtual;
@@ -165,13 +168,16 @@ type
end;
const
- pmMove = 1;
- pmClick = 2;
+ MENU_MDOWN = 8;
+ MENU_MUP = 0;
+
+ 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
@@ -179,21 +185,22 @@ const
implementation
-uses UCommon,
- ULog,
- UMain,
- UDrawTexture,
- UGraphic,
- UDisplay,
- UCovers,
- UTime,
- USkins,
- //Background types
- UMenuBackgroundNone,
- UMenuBackgroundColor,
- UMenuBackgroundTexture,
- UMenuBackgroundVideo,
- UMenuBackgroundFade;
+uses
+ UCommon,
+ UCovers,
+ UDisplay,
+ UDrawTexture,
+ UGraphic,
+ ULog,
+ UMain,
+ USkins,
+ UTime,
+ //Background types
+ UMenuBackgroundNone,
+ UMenuBackgroundColor,
+ UMenuBackgroundTexture,
+ UMenuBackgroundVideo,
+ UMenuBackgroundFade;
destructor TMenu.Destroy;
begin
@@ -218,6 +225,8 @@ begin
ButtonPos := -1;
Background := nil;
+
+ RightMbESC := true;
end;
{
constructor TMenu.Create(Back: string);
@@ -249,7 +258,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
@@ -288,8 +297,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;
@@ -337,8 +346,9 @@ 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;
@@ -350,7 +360,7 @@ procedure TMenu.AddBackground(ThemedSettings: TThemeBackground);
end;
end;
- Function TryBGCreate(Typ: cMenuBackground): boolean;
+ function TryBGCreate(Typ: cMenuBackground): boolean;
begin
Result := true;
@@ -372,7 +382,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
@@ -489,7 +499,7 @@ end;
//----------------------
procedure TMenu.AddButtonCollection(const ThemeCollection: TThemeButtonCollection; const Num: byte);
var
- BT, BTLen: integer;
+ BT, BTLen: integer;
TempCol, TempDCol: cardinal;
begin
@@ -592,17 +602,25 @@ 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
@@ -620,17 +638,32 @@ 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
@@ -648,12 +681,22 @@ 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;
- Static[StatNum].Texture.W := W;
- Static[StatNum].Texture.H := H;
+
+ //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.Z := Z;
if (Typ <> TEXTURE_TYPE_COLORIZED) then
begin
@@ -692,12 +735,22 @@ 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
@@ -709,9 +762,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);
@@ -767,10 +820,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;
@@ -799,8 +852,10 @@ 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
@@ -853,7 +908,7 @@ begin
Button[Result].Reflectionspacing := ReflectionSpacing;
Button[Result].DeSelectReflectionspacing := DeSelectReflectionSpacing;
- //Button Collection Mod
+ // button collection mod
Button[Result].Parent := 0;
// adds interaction
@@ -866,11 +921,10 @@ 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;
@@ -918,9 +972,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
@@ -944,9 +998,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
@@ -989,9 +1043,10 @@ begin
Int := Int - ceil(Length(Interactions) / 2);
//Set Interaction
- if ((Int < 0) or (Int > Length(Interactions) - 1))
- then Int := Interaction //nonvalid button, keep current one
- else Interaction := Int; //select row above
+ if ((Int < 0) or (Int > Length(Interactions) - 1)) then
+ Int := Interaction // invalid button, keep current one
+ else
+ Interaction := Int; // select row above
end;
procedure TMenu.InteractNextRow;
@@ -1003,9 +1058,10 @@ begin
Int := Int + ceil(Length(Interactions) / 2);
//Set Interaction
- if ((Int < 0) or (Int > Length(Interactions) - 1))
- then Int := Interaction //nonvalid button, keep current one
- else Interaction := Int; //select row above
+ if ((Int < 0) or (Int > Length(Interactions) - 1)) then
+ Int := Interaction // invalid button, keep current one
+ else
+ Interaction := Int; // select row above
end;
procedure TMenu.InteractNext;
@@ -1019,7 +1075,8 @@ 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);
@@ -1036,10 +1093,12 @@ 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
@@ -1064,7 +1123,8 @@ 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
@@ -1208,6 +1268,9 @@ 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;
@@ -1250,9 +1313,21 @@ 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;
@@ -1350,10 +1425,12 @@ begin
SetLength(SelectsS[SelectNo].TextOptT, SO + 1);
SelectsS[SelectNo].TextOptT[SO] := AddText;
+{
+ SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh
- //SelectsS[S].SelectedOption := SelectsS[S].SelectOptInt; // refresh
-
- //if SO = Selects[S].PData^ then Selects[S].SelectedOption := SO;
+ 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);
@@ -1453,12 +1530,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
@@ -1527,10 +1604,120 @@ 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 dc37da45..b61a4542 100644
--- a/unicode/src/menu/UMenuBackgroundFade.pas
+++ b/unicode/src/menu/UMenuBackgroundFade.pas
@@ -62,15 +62,17 @@ 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;
@@ -122,7 +124,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);
@@ -151,7 +153,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 c6ff8ab7..923f0b14 100644
--- a/unicode/src/menu/UMenuButton.pas
+++ b/unicode/src/menu/UMenuButton.pas
@@ -55,7 +55,6 @@ type
PosX,
PosY: real;
- constructor Create(); overload;
public
Text: array of TText;
@@ -113,6 +112,7 @@ type
procedure Draw; virtual;
+ constructor Create(); overload;
constructor Create(Textura: TTexture); overload;
constructor Create(Textura, DSTexture: TTexture); overload;
destructor Destroy; override;
@@ -252,42 +252,6 @@ 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;
@@ -571,6 +535,42 @@ 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 c6c6dd81..8b7a1c3f 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 I: Integer;
+procedure TButtonCollection.SetSelect(Value : boolean);
+var
+ Index: integer;
begin
inherited;
//Set Visible for Every Button that is a Child of this ButtonCollection
- if (Not Fade) then
- For I := 0 to High(ScreenButton^) do
- if (ScreenButton^[I].Parent = Parent) then
- ScreenButton^[I].Visible := Value;
+ if (not Fade) then
+ for Index := 0 to High(ScreenButton^) do
+ if (ScreenButton^[Index].Parent = Parent) then
+ ScreenButton^[Index].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 6d77721c..8f57e44a 100644
--- a/unicode/src/menu/UMenuEqualizer.pas
+++ b/unicode/src/menu/UMenuEqualizer.pas
@@ -45,69 +45,71 @@ 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;
+ Direction: boolean;
+ BandLength: integer;
- BandLength: Integer;
-
- Reflection: boolean;
- Reflectionspacing: Real;
+ 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;
@@ -116,31 +118,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);
@@ -188,25 +190,26 @@ 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;
@@ -244,12 +247,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));
@@ -298,22 +301,20 @@ 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 4c2d4e86..beb6bcef 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 1a0fa725..f9f6bbae 100644
--- a/unicode/src/menu/UMenuSelectSlide.pas
+++ b/unicode/src/menu/UMenuSelectSlide.pas
@@ -34,10 +34,10 @@ interface
{$I switches.inc}
uses
- TextGL,
- UTexture,
gl,
- UMenuText;
+ TextGL,
+ UMenuText,
+ UTexture;
type
PSelectSlide = ^TSelectSlide;
@@ -54,17 +54,23 @@ type
TextureSBG: TTexture; // Background Selections Texture
// TextureS: array of TTexture; // Selections Texture (not used)
-// TextureArrowL: TTexture; // Texture for left arrow (not used yet)
-// TextureArrowR: TTexture; // Texture for right arrow (not used yet)
+ Tex_SelectS_ArrowL: TTexture; // Texture for left arrow
+ Tex_SelectS_ArrowR: TTexture; // Texture for right arrow
SelectOptInt: integer;
PData: ^integer;
//For automatically Setting LineCount
- Lines: Byte;
+ 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
//Visibility
- Visible: Boolean;
+ Visible: boolean;
// for selection and deselection
// main static
@@ -121,7 +127,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;
@@ -132,7 +138,12 @@ type
end;
implementation
-uses UDrawTexture, math, ULog, SysUtils;
+
+uses
+ math,
+ SysUtils,
+ UDrawTexture,
+ ULog;
// ------------ Select
constructor TSelectSlide.Create;
@@ -141,24 +152,17 @@ begin
Text := TText.Create;
SetLength(TextOpt, 1);
TextOpt[0] := TText.Create;
-
- //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;}
+ Visible := true;
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;
@@ -173,15 +177,9 @@ begin
TextureSBG.ColG := SBGColG;
TextureSBG.ColB := SBGColB;
TextureSBG.Int := SBGInt;
-
-{ 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
+ end
+ else
+ begin
Texture.ColR := DColR;
Texture.ColG := DColG;
Texture.ColB := DColB;
@@ -196,185 +194,215 @@ 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 //First Option Selected
+ begin
Value := 0;
- for SO := low (TextOpt) to high(TextOpt) do
+ Tex_SelectS_ArrowL.alpha := 0;
+ Tex_SelectS_ArrowR.alpha := 1;
+
+ 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);
- for SO := high(TextOpt) downto low (TextOpt) do
+ //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
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
- 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
- TextOpt[SO].Text := TextOptT[SO];
- end;
+ Tex_SelectS_ArrowL.alpha := 1;
+ Tex_SelectS_ArrowR.alpha := 1;
- 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
+ HalfL := Ceil((Lines - 1) / 2);
+ HalfR := Lines - 1 - HalfL;
+
+ //Selected option is near to the left side
+ if (Value <= HalfL) then
begin
- TextOpt[SO].Text := TextOptT[high(TextOptT)-(Lines-SO-1)];
- end;
+ //Change texts
+ for SO := Low(TextOpt) to High(TextOpt) do
+ begin
+ TextOpt[SO].Text := TextOptT[SO];
+ end;
- DoSelection (HalfL);
- end
- else
- begin
- //Change Texts
- for SO := low (TextOpt) to high(TextOpt) do
+ DoSelection(Value);
+ end
+
+ //Selected option is near to the right side
+ else if (Value > High(TextOptT) - HalfR) then
begin
- TextOpt[SO].Text := TextOptT[Value - HalfL + SO];
- end;
+ 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;
+ DoSelection (HalfL);
+ end
- end;
+ else
+ begin
+ //Change Texts
+ for SO := Low(TextOpt) to High(TextOpt) do
+ begin
+ 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 (Lines <= 0) then
+ 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
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;
+ 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;
- //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;
+ TextOpt[I].Y := TextureSBG.Y + (TextureSBG.H - Text.Size) / 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;
- //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;
+ if (Lines = 1) then
+ begin
+ TextOpt[I].Align := 1; //center text
+ TextOpt[I].X := TextureSBG.X + (TextureSBG.W / 2);
end;
+ end;
end;
end.
diff --git a/unicode/src/menu/UMenuStatic.pas b/unicode/src/menu/UMenuStatic.pas
index 9a10fade..72f4eb36 100644
--- a/unicode/src/menu/UMenuStatic.pas
+++ b/unicode/src/menu/UMenuStatic.pas
@@ -40,19 +40,20 @@ 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 87f9ce54..d3bd213e 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,
- SDL;
+ gl,
+ SDL,
+ TextGL,
+ UTexture;
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;
@@ -78,7 +78,7 @@ type
procedure SetText(Value: UTF8String);
property Text: UTF8String read TextString write SetText;
- procedure DeleteLastLetter; //Procedure to Delete Last Letter
+ procedure DeleteLastLetter; //< Deletes the rightmost letter
procedure Draw;
constructor Create; overload;
@@ -97,35 +97,36 @@ 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; //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
+ 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
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
@@ -135,19 +136,19 @@ var
if T3 = 0 then
T3 := Length(Value);
- //Get Nearest Pos
+ // get nearest pos
NextPos := min(T1, T3{min(T2, T3)});
- if (LastPos = Length(Value)) then
+ if (LastPos = cardinal(Length(Value))) then
NextPos := 0;
- isBreak := (NextPos = T3) AND (NextPos <> Length(Value));
+ isBreak := (NextPos = T3) and (NextPos <> cardinal(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);
@@ -162,14 +163,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);
@@ -177,12 +178,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;
@@ -190,57 +191,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
- //ToDo
- //AddBreak(LastBreak, LastBreak + 155);
+ // to do
+ // 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
- //ToDo
- //AddBreak(LastBreak, LastBreak + 155);
+ // to do
+ // AddBreak(LastBreak, LastBreak + 155);
end;
end;
//end;
Inc(FirstWord)
end;
- //Add Ending
+ // add ending
AddBreak(LastBreak, Length(Value)+1);
end;
@@ -262,33 +263,34 @@ var
X2, Y2: real;
Text2: UTF8String;
I: integer;
+ Ticks: cardinal;
begin
if Visible then
begin
SetFontStyle(Style);
SetFontSize(Size);
- SetFontItalic(False);
+ SetFontItalic(false);
glColor4f(ColR*Int, ColG*Int, ColB*Int, Alpha);
- //Reflection
- if Reflection = true then
+ // reflection
+ if Reflection then
SetFontReflection(true, ReflectionSpacing)
else
SetFontReflection(false,0);
- //if selected set blink...
+ // if selected set blink...
if SelectBool then
begin
- I := SDL_GetTicks() div 550;
- if I <> STicks then
- begin //Change Visability
- STicks := I;
+ Ticks := SDL_GetTicks() div 550;
+ if Ticks <> STicks then
+ begin // change visability
+ STicks := Ticks;
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
@@ -307,20 +309,20 @@ begin
end
else
begin}
- //now use allways:
- //draw text as many strings
+ // now use always:
+ // 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
- 0: X2 := X + MoveX;
- 1: X2 := X + MoveX - glTextWidth(Text2)/2;
- 2: X2 := X + MoveX - glTextWidth(Text2);
+ 1: X2 := X + MoveX - glTextWidth(Text2)/2; { centered }
+ 2: X2 := X + MoveX - glTextWidth(Text2); { right aligned }
+ else X2 := X + MoveX; { left aligned (default) }
end;
SetFontPos(X2, Y2);
@@ -353,7 +355,14 @@ 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;
@@ -371,8 +380,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 25fa96df..cff83d70 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´re hearing, '+
- 'all the people who put massive effort and work in new songs (don´t forget UltraStar w/o songs would be nothing), ppl from '+
+ 'Grandma Deluxe has arrived! Thanks to Corvus5 for the massive work on UltraStar, Wome for the nice tune you are hearing, '+
+ 'all the people who put massive effort and work in new songs (do not forget UltraStar w/o songs would be nothing), ppl from '+
'irc helping us - eBandit and Gabari, scene ppl who really helped instead of compiling and running away. Greetings to DennisTheMenace for betatesting, '+
'Demoscene.tv, pouet.net, KakiArts, Sourceforge,..';
- 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,50 +323,53 @@ 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),
@@ -375,10 +378,10 @@ const
(450,32),(485,34),(444,91),(486,93)
);
begin
- //dis does teh muiwk y0r
+ // dis does teh muiwk y0r to be translated :-)
AudioPlayback.GetFFTData(Data);
- Log.LogStatus('',' JB-1');
+ Log.LogStatus('', ' JB-1');
T := SDL_GetTicks() div 33;
if T <> Credits_Time then
@@ -388,165 +391,172 @@ 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;
-
- glClearColor(0,0,0,0);
- glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
-
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glEnable(GL_BLEND);
+ if CRDTS_Stage = Intro then
+ begin
+ Start3D;
+ glPushMatrix;
- 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);
+ glClearColor(0, 0, 0, 0);
+ glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
- 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);
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
- glPopMatrix;
- End3D;
+ if CTime < Timings[1] then
+ begin
+ myScale := 0.5 + 0.5 * (Timings[1] - CTime) / (Timings[1]); // slowly move layers together
+ myAngle := cos((CTime) * pi / ((Timings[1]) * 2)); // and make logo face towards camera
+ end
+ else
+ begin // this is the part when the logo stands still
+ myScale := 0.5;
+ myAngle := 0;
+ end;
+ if CTime > Timings[2] then
+ begin
+ myScale := 0.5 + 0.5 * (CTime - Timings[2]) / (Timings[3] - Timings[2]); // get some space between layers
+ myAngle := 0;
+ end;
+// if CTime > Timings[3] then myScale := 1; // keep the space between layers
+ glTranslatef(0, 0, -5 + 0.5 * myScale);
+ if CTime > Timings[3] then
+ myScale := 1; // keep the space between layers
+ if CTime > Timings[3] then
+ begin // make logo rotate left and grow
+// myScale := (CTime - Timings[4]) / (Timings[7] - Timings[4]);
+ glRotatef(20 * sqr(CTime - Timings[3]) / sqr((Timings[7] - Timings[3]) / 2), 0, 0, 1);
+ glScalef(1 + sqr(CTime - Timings[3]) / (32 * (Timings[7] - Timings[3])), 1 + sqr(CTime - Timings[3]) / (32 * (Timings[7] - Timings[3])), 1);
+ end;
+ if CTime < Timings[2] then
+ glRotatef(30 * myAngle, 0.5 * myScale + myScale, 1 + myScale, 0);
+// glScalef(0.5, 0.5, 0.5);
+ glScalef(4/3, -1, 1);
+ glColor4f(1, 1, 1, 1);
- // do some sparkling effects
- if (CTime < Timings[1]) and (CTime > Timings[21]) then
- begin
- for k:=1 to 3 do begin
- l:=410+floor((CTime-Timings[21])/(Timings[1]-Timings[21])*(536-410))+RandomRange(-5,5);
- j:=floor((Timings[1]-CTime)/22)+RandomRange(285,301);
- GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0);
- end;
- end;
+ glBindTexture(GL_TEXTURE_2D, intro_layer01.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.4 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.4 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.4 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.4 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer02.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.3 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.3 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.3 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.3 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer03.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.2 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.2 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.2 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.2 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer04.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, -0.1 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, -0.1 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, -0.1 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, -0.1 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer05.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, 0 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, 0 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, 0 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, 0 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer06.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.1 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.1 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.1 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.1 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer07.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.2 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.2 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.2 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.2 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer08.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.3 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.3 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.3 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.3 * myScale);
+ glEnd;
+ glBindTexture(GL_TEXTURE_2D, intro_layer09.TexNum);
+ glbegin(gl_quads);
+ glTexCoord2f(0, 0); glVertex3f(-1, -1, 0.22 * myScale);
+ glTexCoord2f(0, 1); glVertex3f(-1, 1, 0.22 * myScale);
+ glTexCoord2f(1, 1); glVertex3f( 1, 1, 0.22 * myScale);
+ glTexCoord2f(1, 0); glVertex3f( 1, -1, 0.22 * myScale);
+ glEnd;
+ gldisable(gl_texture_2d);
+ glDisable(GL_BLEND);
+
+ glPopMatrix;
+ End3D;
+
+ // do some sparkling effects
+ if (CTime < Timings[1]) and (CTime > Timings[21]) then
+ begin
+ for k:= 1 to 3 do
+ begin
+ l := 410 + floor((CTime - Timings[21]) / (Timings[1] - Timings[21]) * (536 - 410)) + RandomRange(-5, 5);
+ j := floor((Timings[1] - CTime) / 22) + RandomRange(285, 301);
+ GoldenRec.Spawn(l, j, 1, 16, 0, -1, Flare, 0);
+ end;
+ end;
- // fade to white at end
- if Ctime > Timings[6] then
- begin
- glColor4f(1,1,1,sqr(Ctime-Timings[6])*(Ctime-Timings[6])/sqr(Timings[7]-Timings[6]));
- glEnable(GL_BLEND);
- glBegin(GL_QUADS);
- glVertex2f(0,0);
- glVertex2f(0,600);
- glVertex2f(800,600);
- glVertex2f(800,0);
- glEnd;
- glDisable(GL_BLEND);
- end;
+ // fade to white at end
+ if Ctime > Timings[6] then
+ begin
+ glColor4f(1, 1, 1, sqr(CTime - Timings[6]) * (CTime - Timings[6]) / sqr(Timings[7] - Timings[6]));
+ glEnable(GL_BLEND);
+ glBegin(GL_QUADS);
+ glVertex2f( 0, 0);
+ glVertex2f( 0, 600);
+ glVertex2f(800, 600);
+ glVertex2f(800, 0);
+ glEnd;
+ glDisable(GL_BLEND);
+ end;
- end;
+ end;
if (CRDTS_Stage=MainPart) then
// main credits screen background, scroller, logo and girl
begin
@@ -558,10 +568,10 @@ begin
glColor4f(1, 1, 1, 1);
glBindTexture(GL_TEXTURE_2D, credits_bg_tex.TexNum);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,600/1024);glVertex2f(0, 600);
- glTexCoord2f(800/1024,600/1024); glVertex2f(800, 600);
- glTexCoord2f(800/1024,0);glVertex2f(800, 0);
+ glTexCoord2f( 0, 0); glVertex2f( 0, 0);
+ glTexCoord2f( 0, 600/1024); glVertex2f( 0, 600);
+ glTexCoord2f(800/1024, 600/1024); glVertex2f(800, 600);
+ glTexCoord2f(800/1024, 0); glVertex2f(800, 0);
glEnd;
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
@@ -572,38 +582,50 @@ 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);
@@ -616,23 +638,26 @@ begin
end;
glPushMatrix;
- gltranslatef(0,329,0);
- if CTime <= STime+10 then begin glrotatef((CTime-STime)*9+270,0,0,1);end;
- gltranslatef(223,0,0);
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- gltranslatef(223,0,0);
- glrotatef((integer(CTime)-(integer(STime+Delay)-10))*-9,0,0,1);
- gltranslatef(-223,0,0);
- end;
+ gltranslatef(0, 329, 0);
+ if CTime <= STime + 10 then
+ glrotatef((CTime - STime) * 9 + 270, 0, 0, 1);
+ gltranslatef(223, 0, 0);
+ if CTime >= STime + Delay - 10 then
+ if CTime <= STime + Delay then
+ begin
+ gltranslatef(223, 0, 0);
+ glrotatef((integer(CTime) - (integer(STime + Delay) - 10)) * -9, 0, 0, 1);
+ gltranslatef(-223, 0, 0);
+ end;
glBindTexture(GL_TEXTURE_2D, credits_blindguard.TexNum);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
+ glTexCoord2f(0, 0); glVertex2f(-163, -129);
+ glTexCoord2f(0, 1); glVertex2f(-163, 129);
+ glTexCoord2f(1, 1); glVertex2f( 163, 129);
+ glTexCoord2f(1, 0); glVertex2f( 163, -129);
glEnd;
gldisable(gl_texture_2d);
gldisable(GL_BLEND);
@@ -640,35 +665,47 @@ begin
end;
// Blindy (zoom from 0 to full size and rotation, zoom zo doubble size and shift to upper right)
- STime:=Timings[10]-10;
- Delay:=Timings[11]-Timings[10]+5;
+ STime := Timings[10] - 10;
+ Delay := Timings[11] - Timings[10] + 5;
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ k := 0;
+ ESC_Alpha := 20;
try
- for j:=0 to 40 do
+ for j := 0 to 40 do
begin
- if ( j < length( Data ) ) AND
- ( k < length( Data ) ) then
+ if (j < length(Data)) and
+ (k < length(Data)) then
begin
if Data[j] >= Data[k] then
- k:=j;
+ k := j;
end;
end;
except
end;
-
- if Data[k]>0.25 then ESC_Alpha:=5 else inc(ESC_Alpha);
- if ESC_Alpha >20 then ESC_Alpha:=20;
- if ((CTime-STime)<20) then ESC_Alpha:=20;
- if CTime <=STime+10 then j:=CTime-STime else j:=10;
- if (CTime >=STime+Delay-10) then if (CTime <=STime+Delay) then j:=(STime+Delay)-CTime else j:=0;
- 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);
@@ -681,28 +718,31 @@ 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);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- f:=j*10.0;
- gltranslatef(f*3,-f,0);
- glscalef(1+j/10,1+j/10,1+j/10);
- glrotatef(j*9.0,0,0,1);
+ gltranslatef(223, 329, 0);
+ if CTime <= STime + 20 then
+ begin
+ j := CTime - Stime;
+ glscalef(j * j / 400, j * j / 400, j * j / 400);
+ glrotatef(j * 18.0, 0, 0, 1);
end;
+ if CTime >= STime + Delay - 10 then
+ if CTime <= STime + Delay then
+ begin
+ j := CTime - (STime + Delay - 10);
+ f := j * 10.0;
+ gltranslatef(f * 3, -f, 0);
+ glscalef(1 + j / 10, 1 + j / 10, 1 + j / 10);
+ glrotatef(j * 9.0, 0, 0, 1);
+ end;
glBindTexture(GL_TEXTURE_2D, credits_blindy.TexNum);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
+ 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);
@@ -710,35 +750,47 @@ begin
end;
// Canni (shift in from left, shift out to upper right)
- STime:=Timings[11]-10;
- Delay:=Timings[12]-Timings[11]+5;
+ STime := Timings[11] - 10;
+ Delay := Timings[12] - Timings[11] + 5;
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ 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);
@@ -751,23 +803,26 @@ begin
end;
glPushMatrix;
- gltranslatef(223,329,0);
- if CTime <= STime+10 then begin
- gltranslatef(((CTime-STime)*21.0)-210,0,0);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=(CTime-(STime+Delay-10))*21;
- gltranslatef(j,-j/2,0);
+ gltranslatef(223, 329, 0);
+ if CTime <= STime + 10 then
+ begin
+ gltranslatef(((CTime - STime) * 21.0) - 210, 0, 0);
end;
+ if CTime >= STime + Delay - 10 then
+ if CTime <= STime + Delay then
+ begin
+ j := (CTime - (STime + Delay - 10)) * 21;
+ gltranslatef(j, -j / 2, 0);
+ end;
glBindTexture(GL_TEXTURE_2D, credits_canni.TexNum);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
+ 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);
@@ -775,35 +830,47 @@ begin
end;
// Commandio (flip in from down, flip out to upper right)
- STime:=Timings[12]-10;
- Delay:=Timings[13]-Timings[12];
+ STime := Timings[12] - 10;
+ Delay := Timings[13] - Timings[12];
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ 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);
@@ -816,25 +883,27 @@ 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);
@@ -842,46 +911,57 @@ 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);
@@ -889,36 +969,47 @@ begin
end;
// Mog (flip in from right, flip out to lower right)
- STime:=Timings[14]-10;
- Delay:=Timings[15]-Timings[14]+5;
+ STime := Timings[14] - 10;
+ Delay := Timings[15] - Timings[14] + 5;
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
-
+ 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);
@@ -931,26 +1022,28 @@ 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);
@@ -958,35 +1051,47 @@ begin
end;
// Mota (rotate in from upper right, shift out to lower left while shrinking and rotateing)
- STime:=Timings[15]-10;
- Delay:=Timings[16]-Timings[15]+5;
+ STime := Timings[15] - 10;
+ Delay := Timings[16] - Timings[15] + 5;
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ 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);
@@ -999,28 +1104,31 @@ 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);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- f:=j*10.0;
- gltranslatef(-f*2,-f,0);
- glscalef(1-j/10,1-j/10,1-j/10);
- glrotatef(-j*9.0,0,0,1);
+ gltranslatef(223, 329, 0);
+ if CTime <= STime + 10 then
+ begin
+ gltranslatef(223, 0, 0);
+ glrotatef((10 - (CTime - STime)) * 9, 0, 0, 1);
+ gltranslatef(-223, 0, 0);
end;
+ if CTime >= STime + Delay - 10 then
+ if CTime <= STime + Delay then
+ begin
+ j := CTime - (STime + Delay - 10);
+ f := j * 10.0;
+ gltranslatef(-f * 2, -f, 0);
+ glscalef(1 - j / 10, 1 - j / 10, 1 - j / 10);
+ glrotatef(-j * 9.0, 0, 0, 1);
+ end;
glBindTexture(GL_TEXTURE_2D, credits_mota.TexNum);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
+ 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);
@@ -1028,35 +1136,47 @@ begin
end;
// Skillmaster (shift in from lower right, rotate out to upper right)
- STime:=Timings[16]-10;
- Delay:=Timings[17]-Timings[16]+5;
+ STime := Timings[16] - 10;
+ Delay := Timings[17] - Timings[16] + 5;
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ 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);
@@ -1069,28 +1189,31 @@ 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);
- end;
- if CTime >=STime+Delay-10 then if CTime <=STime+Delay then begin
- j:=CTime-(STime+Delay-10);
- gltranslatef(0,-223,0);
- glrotatef(integer(j)*-9,0,0,1);
- gltranslatef(0,223,0);
- glrotatef(j*9,0,0,1);
+ gltranslatef(223, 329, 0);
+ if CTime <= STime + 10 then
+ begin
+ j := STime + 10 - CTime;
+ f := j * 10.0;
+ gltranslatef(+f * 2, +f / 2, 0);
end;
+ if CTime >= STime + Delay - 10 then
+ if CTime <= STime + Delay then
+ begin
+ j := CTime - (STime + Delay - 10);
+ gltranslatef(0, -223, 0);
+ glrotatef(integer(j) * -9, 0, 0, 1);
+ gltranslatef(0, 223, 0);
+ glrotatef(j * 9, 0, 0, 1);
+ end;
glBindTexture(GL_TEXTURE_2D, credits_skillmaster.TexNum);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(-163, -129);
- glTexCoord2f(0,1);glVertex2f(-163, 129);
- glTexCoord2f(1,1); glVertex2f(163, 129);
- glTexCoord2f(1,0);glVertex2f(163, -129);
+ 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);
@@ -1098,35 +1221,47 @@ begin
end;
// WhiteShark (flip in from lower left, flip out to upper right)
- STime:=Timings[17]-10;
- Delay:=Timings[18]-Timings[17];
+ STime := Timings[17] - 10;
+ Delay := Timings[18] - Timings[17];
if CTime > STime then
begin
- k:=0;
- ESC_Alpha:=20;
+ 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);
@@ -1139,20 +1274,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);
@@ -1160,51 +1295,50 @@ 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);
@@ -1212,21 +1346,21 @@ begin
glColor4f(1, 1, 1, 1);
glBindTexture(GL_TEXTURE_2D, credits_bg_ovl.TexNum);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(800-393, 0);
- glTexCoord2f(0,600/1024);glVertex2f(800-393, 600);
- glTexCoord2f(393/512,600/1024); glVertex2f(800, 600);
- glTexCoord2f(393/512,0);glVertex2f(800, 0);
+ glTexCoord2f( 0, 0); glVertex2f(800-393, 0);
+ glTexCoord2f( 0, 600/1024); glVertex2f(800-393, 600);
+ glTexCoord2f(393/512, 600/1024); glVertex2f(800, 600);
+ glTexCoord2f(393/512, 0); glVertex2f(800, 0);
glEnd;
- {
+{
glBindTexture(GL_TEXTURE_2D, credits_bg_logo.TexNum);
glbegin(gl_quads);
- glTexCoord2f(0,0);glVertex2f(0, 0);
- glTexCoord2f(0,112/128);glVertex2f(0, 112);
- glTexCoord2f(497/512,112/128); glVertex2f(497, 112);
- glTexCoord2f(497/512,0);glVertex2f(497, 0);
+ glTexCoord2f( 0, 0); glVertex2f( 0, 0);
+ glTexCoord2f( 0, 112/128); glVertex2f( 0, 112);
+ glTexCoord2f(497/512, 112/128); glVertex2f(497, 112);
+ glTexCoord2f(497/512, 0); glVertex2f(497, 0);
glEnd;
- }
+}
gldisable(gl_texture_2d);
glDisable(GL_BLEND);
@@ -1234,33 +1368,35 @@ 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
@@ -1272,34 +1408,36 @@ 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);
@@ -1308,17 +1446,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 835590ed..109a828b 100644
--- a/unicode/src/screens/UScreenEditConvert.pas
+++ b/unicode/src/screens/UScreenEditConvert.pas
@@ -34,6 +34,7 @@ interface
{$I switches.inc}
uses
+ math,
UMenu,
SDL,
{$IFDEF UseMIDIPort}
@@ -137,7 +138,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
@@ -180,15 +181,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;
@@ -197,9 +198,9 @@ begin
end;
if Interaction = 3 then
- begin
+ begin
if SelectedNumber > 0 then
- begin
+ begin
Extract;
SaveSong(Song, Lines, ChangeFileExt(ConversionFileName, '.txt'), false);
end;
@@ -210,16 +211,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
@@ -245,13 +246,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;
@@ -313,7 +314,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);
@@ -335,7 +336,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;
@@ -453,7 +454,6 @@ begin
AddButton(500, 20, 100, 40, Skin.GetTextureFileName('ButtonF'));
AddButtonText(20, 5, 0, 0, 0, 'Save');
-
{ MidiOut := TMidiOutput.Create(nil);
// MidiOut.Close;
// MidiOut.DeviceID := 0;
@@ -493,13 +493,11 @@ begin
Log.LogStatus(MidiOut.ProductName, 'MIDI');
MidiOut.Open;
-
if FileExists(ConversionFileName) then
begin
MidiFile.Filename := ConversionFileName;
MidiFile.ReadFile;
-
Len := 0;
Sel := 0;
BPM := MidiFile.Bpm;
@@ -579,7 +577,7 @@ var
Bottom: real;
X: real;
Y: real;
- H: real;
+ Height: real;
YSkip: real;
begin
// draw static menu
@@ -587,20 +585,24 @@ begin
Y := 100;
- H := Length(ATrack)*40;
- if H > 480 then
- H := 480;
- Bottom := Y + H;
+ Height := min(480, 40 * Length(ATrack));
+ Bottom := Y + Height;
- YSkip := H / Length(ATrack);
+ if Length(ATrack) = 0 then // prevent crash with uncomplete code.
+ begin
+ Log.LogDebug ('UScreenEditConvert -> TScreenEditConvert.Draw:', 'Length(ATrack) = 0');
+ YSkip := 40;
+ end
+ else
+ YSkip := Height / Length(ATrack);
// select
- DrawQuad(10, Y+Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
+ DrawQuad(10, Y + Sel*YSkip, 780, YSkip, 0.8, 0.8, 0.8);
// selected - now me use Status System
for Count := 0 to High(ATrack) do
if ATrack[Count].Hear then
- DrawQuad(10, Y+Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
+ DrawQuad(10, Y + Count*YSkip, 50, YSkip, 0.8, 0.3, 0.3);
glColor3f(0, 0, 0);
for Count := 0 to High(ATrack) do
begin
@@ -618,12 +620,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
@@ -636,9 +638,21 @@ begin
for Count2 := 0 to High(ATrack[Count].Note) do
begin
if ATrack[Count].Note[Count2].EventType = 9 then
- DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127, 3, 3, ColR[Count], ColG[Count], ColB[Count]);
+ DrawQuad(60 + ATrack[Count].Note[Count2].Start/Len*725,
+ Y + (Count+1)*YSkip - ATrack[Count].Note[Count2].Data1*35/127,
+ 3,
+ 3,
+ ColR[Count],
+ ColG[Count],
+ ColB[Count]);
if ATrack[Count].Note[Count2].EventType = 15 then
- DrawLine(60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + 0.75 * YSkip + Count*YSkip, 60 + ATrack[Count].Note[Count2].Start/Len * 725, Y + YSkip + Count*YSkip, ColR[Count], ColG[Count], ColB[Count]);
+ DrawLine(60 + ATrack[Count].Note[Count2].Start/Len*725,
+ Y + 0.75*YSkip + Count*YSkip,
+ 60 + ATrack[Count].Note[Count2].Start/Len*725,
+ Y + YSkip + Count*YSkip,
+ ColR[Count],
+ ColG[Count],
+ ColB[Count]);
end;
// playing line
diff --git a/unicode/src/screens/UScreenEditHeader.pas b/unicode/src/screens/UScreenEditHeader.pas
index 2548069d..fed226ba 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 a892651a..23ab427b 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,7 +1184,6 @@ begin
CopySentence(Src + C, Dst + C);
end;
-
constructor TScreenEditSub.Create;
begin
inherited Create;
@@ -1253,7 +1252,7 @@ begin
else
Error := not CurrentSong.LoadSong();
except
- Error := True;
+ Error := true;
end;
if Error then
@@ -1285,7 +1284,7 @@ begin
Lyric.Clear;
Lyric.X := 400;
Lyric.Y := 500;
- Lyric.Align := center;
+ Lyric.Align := atCenter;
Lyric.Size := 42;
Lyric.ColR := 0;
Lyric.ColG := 0;
@@ -1318,7 +1317,6 @@ begin
{$IFDEF UseMIDIPort}
MidiPos := USTime.GetTime - MidiTime + MidiStart;
-
// stop the music
if (MidiPos > MidiStop) then
begin
@@ -1337,7 +1335,6 @@ begin
if (Lines[0].Line[Lines[0].Current].Note[Pet].Start = AktBeat) then
begin
-
LastClick := AktBeat;
{$IFDEF UseMIDIPort}
if Pet > 0 then
@@ -1429,7 +1426,8 @@ begin
end;
function TScreenEditSub.GetNoteName(Note: integer): string;
-var N1, N2: integer;
+var
+ N1, N2: integer;
begin
if (Note > 0) then
begin
diff --git a/unicode/src/screens/UScreenLevel.pas b/unicode/src/screens/UScreenLevel.pas
index 188b32f2..caf63a33 100644
--- a/unicode/src/screens/UScreenLevel.pas
+++ b/unicode/src/screens/UScreenLevel.pas
@@ -34,30 +34,37 @@ 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 e52823be..2de700ab 100644
--- a/unicode/src/screens/UScreenLoading.pas
+++ b/unicode/src/screens/UScreenLoading.pas
@@ -43,18 +43,20 @@ uses
type
TScreenLoading = class(TMenu)
public
- Fadeout: boolean;
+ Fadeout: boolean;
+
constructor Create; override;
- procedure onShow; override;
- function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override;
+ procedure onShow; 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 eb2e051e..8ce6307c 100644
--- a/unicode/src/screens/UScreenMain.pas
+++ b/unicode/src/screens/UScreenMain.pas
@@ -52,10 +52,7 @@ type
function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char;
PressedDown: boolean): boolean; override;
procedure onShow; override;
- procedure InteractNext; override;
- procedure InteractPrev; override;
- procedure InteractInc; override;
- procedure InteractDec; override;
+ procedure SetInteraction(Num: integer); override;
procedure SetAnimationProgress(Progress: real); override;
end;
@@ -80,7 +77,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);
@@ -90,7 +87,7 @@ begin
// check normal keys
case UCS4UpperCase(CharCode) of
Ord('Q'): begin
- Result := False;
+ Result := false;
Exit;
end;
Ord('C'): begin
@@ -124,7 +121,7 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE:
begin
- Result := False;
+ Result := false;
end;
SDLK_RETURN:
@@ -139,7 +136,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
@@ -183,7 +180,7 @@ begin
//Exit
if Interaction = 5 then
begin
- Result := False;
+ Result := false;
end;
end;
{**
@@ -234,36 +231,19 @@ end;
procedure TScreenMain.onShow;
begin
inherited;
+
+ { display cursor (on moved) }
+ Display.SetCursor;
+
{**
* Start background music
*}
SoundLib.StartBgMusic;
end;
-procedure TScreenMain.InteractNext;
-begin
- inherited InteractNext;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
-end;
-
-procedure TScreenMain.InteractPrev;
-begin
- inherited InteractPrev;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
-end;
-
-procedure TScreenMain.InteractDec;
-begin
- inherited InteractDec;
- Text[TextDescription].Text := Theme.Main.Description[Interaction];
- Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
-end;
-
-procedure TScreenMain.InteractInc;
+procedure TScreenMain.SetInteraction(Num: integer);
begin
- inherited InteractInc;
+ inherited SetInteraction(Num);
Text[TextDescription].Text := Theme.Main.Description[Interaction];
Text[TextDescriptionLong].Text := Theme.Main.DescriptionLong[Interaction];
end;
diff --git a/unicode/src/screens/UScreenName.pas b/unicode/src/screens/UScreenName.pas
index 64e90cc9..dc2f14ef 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,7 +196,6 @@ begin
Button[Interaction].Text[0].Text := Ini.NameTemplate[11];
end;
-
SDLK_BACKSPACE:
begin
Button[Interaction].Text[0].DeleteLastLetter;
@@ -224,7 +223,7 @@ begin
else
FadeTo(@ScreenLevel);
- GoTo_SingScreen := False;
+ GoTo_SingScreen := false;
end;
// Up and Down could be done at the same time,
@@ -246,7 +245,6 @@ begin
LoadFromTheme(Theme.Name);
-
for I := 1 to 6 do
AddButton(Theme.Name.ButtonPlayer[I]);
@@ -262,12 +260,14 @@ begin
for I := 1 to 6 do
Button[I-1].Text[0].Text := Ini.Name[I-1];
- for I := 1 to PlayersPlay do begin
+ for I := 1 to PlayersPlay do
+ begin
Button[I-1].Visible := true;
Button[I-1].Selectable := true;
end;
- for I := PlayersPlay+1 to 6 do begin
+ for I := PlayersPlay+1 to 6 do
+ begin
Button[I-1].Visible := false;
Button[I-1].Selectable := false;
end;
diff --git a/unicode/src/screens/UScreenOpen.pas b/unicode/src/screens/UScreenOpen.pas
index fa65a1df..718ef546 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,7 +207,8 @@ begin
Interaction := 0;
end;
-(*function TScreenEditSub.Draw: boolean;
+(*
+function TScreenEditSub.Draw: boolean;
var
Min: integer;
Sec: integer;
@@ -219,6 +220,7 @@ end;
procedure TScreenEditSub.Finish;
begin
//
-end;*)
+end;
+*)
end.
diff --git a/unicode/src/screens/UScreenOptions.pas b/unicode/src/screens/UScreenOptions.pas
index ff2a3fe2..24f1f3d7 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 a6564bf1..b2337e08 100644
--- a/unicode/src/screens/UScreenOptionsAdvanced.pas
+++ b/unicode/src/screens/UScreenOptionsAdvanced.pas
@@ -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,7 +85,8 @@ begin
begin
//SelectLoadAnimation Hidden because it is useless atm
//if SelInteraction = 7 then begin
- if SelInteraction = 6 then begin
+ if SelInteraction = 6 then
+ begin
Ini.Save;
AudioPlayback.PlaySound(SoundLib.Back);
FadeTo(@ScreenOptions);
@@ -99,7 +100,8 @@ begin
begin
//SelectLoadAnimation Hidden because it is useless atm
//if (SelInteraction >= 0) and (SelInteraction <= 6) then begin
- if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractInc;
end;
@@ -108,7 +110,8 @@ begin
begin
//SelectLoadAnimation Hidden because it is useless atm
//if (SelInteraction >= 0) and (SelInteraction <= 6) then begin
- if (SelInteraction >= 0) and (SelInteraction <= 5) then begin
+ if (SelInteraction >= 0) and (SelInteraction <= 5) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractDec;
end;
@@ -127,11 +130,28 @@ begin
//SelectLoadAnimation Hidden because it is useless atm
//AddSelect(Theme.OptionsAdvanced.SelectLoadAnimation, Ini.LoadAnimation, ILoadAnimation);
+ Theme.OptionsAdvanced.SelectScreenFade.showArrows := true;
+ Theme.OptionsAdvanced.SelectScreenFade.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectScreenFade, Ini.ScreenFade, IScreenFade);
+
+ Theme.OptionsAdvanced.SelectEffectSing.showArrows := true;
+ Theme.OptionsAdvanced.SelectEffectSing.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectEffectSing, Ini.EffectSing, IEffectSing);
+
+ Theme.OptionsAdvanced.SelectLineBonus.showArrows := true;
+ Theme.OptionsAdvanced.SelectLineBonus.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectLineBonus, Ini.LineBonus, ILineBonus);
+
+ Theme.OptionsAdvanced.SelectOnSongClick.showArrows := true;
+ Theme.OptionsAdvanced.SelectOnSongClick.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectOnSongClick, Ini.OnSongClick, IOnSongClick);
+
+ Theme.OptionsAdvanced.SelectAskbeforeDel.showArrows := true;
+ Theme.OptionsAdvanced.SelectAskbeforeDel.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectAskbeforeDel, Ini.AskBeforeDel, IAskbeforeDel);
+
+ Theme.OptionsAdvanced.SelectPartyPopup.showArrows := true;
+ Theme.OptionsAdvanced.SelectPartyPopup.oneItemOnly := true;
AddSelectSlide(Theme.OptionsAdvanced.SelectPartyPopup, Ini.PartyPopup, IPartyPopup);
AddButton(Theme.OptionsAdvanced.ButtonExit);
diff --git a/unicode/src/screens/UScreenOptionsGame.pas b/unicode/src/screens/UScreenOptionsGame.pas
index c5af4ca2..515b0110 100644
--- a/unicode/src/screens/UScreenOptionsGame.pas
+++ b/unicode/src/screens/UScreenOptionsGame.pas
@@ -48,7 +48,7 @@ type
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,10 +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
@@ -81,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);
@@ -126,15 +126,34 @@ begin
old_Sorting := Ini.Sorting;
old_Tabs := Ini.Tabs;
+ Theme.OptionsGame.SelectPlayers.showArrows := true;
+ Theme.OptionsGame.SelectPlayers.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectPlayers, Ini.Players, IPlayers);
+
+ Theme.OptionsGame.SelectDifficulty.showArrows := true;
+ Theme.OptionsGame.SelectDifficulty.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDifficulty, Ini.Difficulty, IDifficulty);
+
+ Theme.OptionsGame.SelectLanguage.showArrows := true;
+ Theme.OptionsGame.SelectLanguage.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectLanguage, Ini.Language, ILanguage);
+
+ Theme.OptionsGame.SelectTabs.showArrows := true;
+ Theme.OptionsGame.SelectTabs.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectTabs, Ini.Tabs, ITabs);
+
+ Theme.OptionsGame.SelectSorting.showArrows := true;
+ Theme.OptionsGame.SelectSorting.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectSorting, Ini.Sorting, ISorting);
+
+ Theme.OptionsGame.SelectDebug.showArrows := true;
+ Theme.OptionsGame.SelectDebug.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGame.SelectDebug, Ini.Debug, IDebug);
+
+
AddButton(Theme.OptionsGame.ButtonExit);
- if (Length(Button[0].Text)=0) then
+ if (Length(Button[0].Text) = 0) then
AddButtonText(14, 20, Theme.Options.Description[7]);
end;
@@ -142,7 +161,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 a0890dbe..155b9ded 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,10 +84,12 @@ begin
end;
SDLK_RETURN:
begin
-{ if SelInteraction <= 1 then begin
+{ if SelInteraction <= 1 then
+ begin
Restart := true;
end;}
- if SelInteraction = 6 then begin
+ if SelInteraction = 6 then
+ begin
Ini.Save;
AudioPlayback.PlaySound(SoundLib.Back);
// FIXME: changing the video mode does not work this way in windows
@@ -105,14 +107,16 @@ begin
InteractPrev;
SDLK_RIGHT:
begin
- if (SelInteraction >= 0) and (SelInteraction < 6) then begin
+ if (SelInteraction >= 0) and (SelInteraction < 6) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractInc;
end;
end;
SDLK_LEFT:
begin
- if (SelInteraction >= 0) and (SelInteraction < 6) then begin
+ if (SelInteraction >= 0) and (SelInteraction < 6) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractDec;
end;
@@ -128,13 +132,29 @@ begin
inherited Create;
LoadFromTheme(Theme.OptionsGraphics);
- AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution);
- AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen);
- AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth);
- AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer);
+ Theme.OptionsGraphics.SelectResolution.showArrows := true;
+ Theme.OptionsGraphics.SelectResolution.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsGraphics.SelectResolution, Ini.Resolution, IResolution);
+
+ Theme.OptionsGraphics.SelectFullscreen.showArrows := true;
+ Theme.OptionsGraphics.SelectFullscreen.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsGraphics.SelectFullscreen, Ini.Fullscreen, IFullscreen);
+
+ Theme.OptionsGraphics.SelectDepth.showArrows := true;
+ Theme.OptionsGraphics.SelectDepth.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsGraphics.SelectDepth, Ini.Depth, IDepth);
+
+ Theme.OptionsGraphics.SelectVisualizer.showArrows := true;
+ Theme.OptionsGraphics.SelectVisualizer.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsGraphics.SelectVisualizer, Ini.VisualizerOption, IVisualizer);
+
+ Theme.OptionsGraphics.SelectOscilloscope.showArrows := true;
+ Theme.OptionsGraphics.SelectOscilloscope.oneItemOnly := true;
AddSelectSlide(Theme.OptionsGraphics.SelectOscilloscope, Ini.Oscilloscope, IOscilloscope);
- AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize);
+ Theme.OptionsGraphics.SelectMovieSize.showArrows := true;
+ Theme.OptionsGraphics.SelectMovieSize.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsGraphics.SelectMovieSize, Ini.MovieSize, IMovieSize);
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 c8995ae4..b4ef7dc2 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,7 +83,8 @@ begin
end;
SDLK_RETURN:
begin
- if SelInteraction = 3 then begin
+ if SelInteraction = 3 then
+ begin
Ini.Save;
AudioPlayback.PlaySound(SoundLib.Back);
FadeTo(@ScreenOptions);
@@ -95,14 +96,16 @@ begin
InteractPrev;
SDLK_RIGHT:
begin
- if (SelInteraction >= 0) and (SelInteraction <= 3) then begin
+ if (SelInteraction >= 0) and (SelInteraction <= 3) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractInc;
end;
end;
SDLK_LEFT:
begin
- if (SelInteraction >= 0) and (SelInteraction <= 3) then begin
+ if (SelInteraction >= 0) and (SelInteraction <= 3) then
+ begin
AudioPlayback.PlaySound(SoundLib.Option);
InteractDec;
end;
@@ -117,11 +120,17 @@ begin
LoadFromTheme(Theme.OptionsLyrics);
+ Theme.OptionsLyrics.SelectLyricsFont.showArrows := true;
+ Theme.OptionsLyrics.SelectLyricsFont.oneItemOnly := true;
AddSelectSlide(Theme.OptionsLyrics.SelectLyricsFont, Ini.LyricsFont, ILyricsFont);
+
+ Theme.OptionsLyrics.SelectLyricsEffect.showArrows := true;
+ Theme.OptionsLyrics.SelectLyricsEffect.oneItemOnly := true;
AddSelectSlide(Theme.OptionsLyrics.SelectLyricsEffect, Ini.LyricsEffect, ILyricsEffect);
- //AddSelect(Theme.OptionsLyrics.SelectSolmization, Ini.Solmization, ISolmization); GAH!!!!11 DIE!!!
- AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines);
+ Theme.OptionsLyrics.SelectNoteLines.showArrows := true;
+ Theme.OptionsLyrics.SelectNoteLines.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsLyrics.SelectNoteLines, Ini.NoteLines, INoteLines);
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 0cf9eb37..cdacd5f6 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,6 +245,8 @@ begin
InputDeviceNames[DeviceIndex] := AudioInputProcessor.DeviceList[DeviceIndex].Name;
end;
// add device-selection slider (InteractionID: 0)
+ Theme.OptionsRecord.SelectSlideCard.showArrows := true;
+ Theme.OptionsRecord.SelectSlideCard.oneItemOnly := true;
AddSelectSlide(Theme.OptionsRecord.SelectSlideCard, CurrentDeviceIndex, InputDeviceNames);
// init source-selection slider
@@ -253,6 +255,9 @@ begin
begin
InputSourceNames[SourceIndex] := InputDevice.Source[SourceIndex].Name;
end;
+
+ Theme.OptionsRecord.SelectSlideInput.showArrows := true;
+ Theme.OptionsRecord.SelectSlideInput.oneItemOnly := true;
// add source-selection slider (InteractionID: 1)
SelectInputSourceID := AddSelectSlide(Theme.OptionsRecord.SelectSlideInput,
InputDeviceCfg.Input, InputSourceNames);
@@ -485,7 +490,6 @@ begin
PreviewDeviceIndex := -1;
end;
-
procedure TScreenOptionsRecord.DrawVolume(x, y, Width, Height: single);
var
x1, y1, x2, y2: single;
@@ -803,8 +807,7 @@ begin
end;
end;
- Result := True;
+ Result := true;
end;
-
end.
diff --git a/unicode/src/screens/UScreenOptionsSound.pas b/unicode/src/screens/UScreenOptionsSound.pas
index d0125a9d..78bf9633 100644
--- a/unicode/src/screens/UScreenOptionsSound.pas
+++ b/unicode/src/screens/UScreenOptionsSound.pas
@@ -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,19 +137,39 @@ begin
LoadFromTheme(Theme.OptionsSound);
- AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough,
- Ini.VoicePassthrough, IVoicePassthrough);
- AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic,
- Ini.BackgroundMusicOption, IBackgroundMusic);
- AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost);
+ Theme.OptionsSound.SelectSlideVoicePassthrough.showArrows := true;
+ Theme.OptionsSound.SelectSlideVoicePassthrough.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsSound.SelectSlideVoicePassthrough, Ini.VoicePassthrough, IVoicePassthrough);
+
+ Theme.OptionsSound.SelectBackgroundMusic.showArrows := true;
+ Theme.OptionsSound.SelectBackgroundMusic.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsSound.SelectBackgroundMusic, Ini.BackgroundMusicOption, IBackgroundMusic);
+
// TODO: - MicBoost needs to be moved to ScreenOptionsRecord
+ Theme.OptionsSound.SelectMicBoost.showArrows := true;
+ Theme.OptionsSound.SelectMicBoost.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsSound.SelectMicBoost, Ini.MicBoost, IMicBoost);
+
+
+ Theme.OptionsSound.SelectClickAssist.showArrows := true;
+ Theme.OptionsSound.SelectClickAssist.oneItemOnly := true;
AddSelectSlide(Theme.OptionsSound.SelectClickAssist, Ini.ClickAssist, IClickAssist);
+
+ Theme.OptionsSound.SelectBeatClick.showArrows := true;
+ Theme.OptionsSound.SelectBeatClick.oneItemOnly := true;
AddSelectSlide(Theme.OptionsSound.SelectBeatClick, Ini.BeatClick, IBeatClick);
+
+ Theme.OptionsSound.SelectThreshold.showArrows := true;
+ Theme.OptionsSound.SelectThreshold.oneItemOnly := true;
AddSelectSlide(Theme.OptionsSound.SelectThreshold, Ini.ThresholdIndex, IThreshold);
- AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume,
- Ini.PreviewVolume, IPreviewVolume);
- AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading,
- Ini.PreviewFading, IPreviewFading);
+
+ Theme.OptionsSound.SelectSlidePreviewVolume.showArrows := true;
+ Theme.OptionsSound.SelectSlidePreviewVolume.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewVolume, Ini.PreviewVolume, IPreviewVolume);
+
+ Theme.OptionsSound.SelectSlidePreviewFading.showArrows := true;
+ Theme.OptionsSound.SelectSlidePreviewFading.oneItemOnly := true;
+ AddSelectSlide(Theme.OptionsSound.SelectSlidePreviewFading, Ini.PreviewFading, IPreviewFading);
AddButton(Theme.OptionsSound.ButtonExit);
if (Length(Button[0].Text) = 0) then
diff --git a/unicode/src/screens/UScreenOptionsThemes.pas b/unicode/src/screens/UScreenOptionsThemes.pas
index 64816d34..9025582c 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,10 +162,16 @@ begin
LoadFromTheme(Theme.OptionsThemes);
+ Theme.OptionsThemes.SelectTheme.showArrows := true;
+ Theme.OptionsThemes.SelectTheme.oneItemOnly := true;
AddSelectSlide(Theme.OptionsThemes.SelectTheme, Ini.Theme, ITheme);
+ Theme.OptionsThemes.SelectSkin.showArrows := true;
+ Theme.OptionsThemes.SelectSkin.oneItemOnly := true;
SkinSelect := AddSelectSlide(Theme.OptionsThemes.SelectSkin, Ini.SkinNo, ISkin);
+ Theme.OptionsThemes.SelectColor.showArrows := true;
+ Theme.OptionsThemes.SelectColor.oneItemOnly := true;
AddSelectSlide(Theme.OptionsThemes.SelectColor, Ini.Color, IColor);
AddButton(Theme.OptionsThemes.ButtonExit);
@@ -191,7 +197,6 @@ 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 afcf2f9d..e09393b4 100644
--- a/unicode/src/screens/UScreenPartyNewRound.pas
+++ b/unicode/src/screens/UScreenPartyNewRound.pas
@@ -46,61 +46,60 @@ type
TScreenPartyNewRound = class(TMenu)
public
//Texts:
- TextRound1: Cardinal;
- TextRound2: Cardinal;
- TextRound3: Cardinal;
- TextRound4: Cardinal;
- TextRound5: Cardinal;
- TextRound6: Cardinal;
- TextRound7: Cardinal;
-
- TextWinner1: Cardinal;
- TextWinner2: Cardinal;
- TextWinner3: Cardinal;
- TextWinner4: Cardinal;
- TextWinner5: Cardinal;
- TextWinner6: Cardinal;
- TextWinner7: Cardinal;
-
- TextNextRound: Cardinal;
- TextNextRoundNo: Cardinal;
- TextNextPlayer1: Cardinal;
- TextNextPlayer2: Cardinal;
- TextNextPlayer3: Cardinal;
+ TextRound1: cardinal;
+ TextRound2: cardinal;
+ TextRound3: cardinal;
+ TextRound4: cardinal;
+ TextRound5: cardinal;
+ TextRound6: cardinal;
+ TextRound7: cardinal;
+
+ TextWinner1: cardinal;
+ TextWinner2: cardinal;
+ TextWinner3: cardinal;
+ TextWinner4: cardinal;
+ TextWinner5: cardinal;
+ TextWinner6: cardinal;
+ TextWinner7: cardinal;
+
+ TextNextRound: cardinal;
+ TextNextRoundNo: cardinal;
+ TextNextPlayer1: cardinal;
+ TextNextPlayer2: cardinal;
+ TextNextPlayer3: cardinal;
//Statics
- StaticRound1: Cardinal;
- StaticRound2: Cardinal;
- StaticRound3: Cardinal;
- StaticRound4: Cardinal;
- StaticRound5: Cardinal;
- StaticRound6: Cardinal;
- StaticRound7: Cardinal;
+ StaticRound1: cardinal;
+ StaticRound2: cardinal;
+ StaticRound3: cardinal;
+ StaticRound4: cardinal;
+ StaticRound5: cardinal;
+ StaticRound6: cardinal;
+ StaticRound7: cardinal;
//Scores
- TextScoreTeam1: Cardinal;
- TextScoreTeam2: Cardinal;
- TextScoreTeam3: Cardinal;
- TextNameTeam1: Cardinal;
- TextNameTeam2: Cardinal;
- TextNameTeam3: Cardinal;
+ TextScoreTeam1: cardinal;
+ TextScoreTeam2: cardinal;
+ TextScoreTeam3: cardinal;
+ TextNameTeam1: cardinal;
+ TextNameTeam2: cardinal;
+ TextNameTeam3: cardinal;
- TextTeam1Players: Cardinal;
- TextTeam2Players: Cardinal;
- TextTeam3Players: Cardinal;
-
- StaticTeam1: Cardinal;
- StaticTeam2: Cardinal;
- StaticTeam3: Cardinal;
- StaticNextPlayer1: Cardinal;
- StaticNextPlayer2: Cardinal;
- StaticNextPlayer3: Cardinal;
+ TextTeam1Players: cardinal;
+ TextTeam2Players: cardinal;
+ TextTeam3Players: cardinal;
+ StaticTeam1: cardinal;
+ StaticTeam2: cardinal;
+ StaticTeam3: cardinal;
+ StaticNextPlayer1: cardinal;
+ StaticNextPlayer2: cardinal;
+ StaticNextPlayer3: cardinal;
constructor Create; override;
- function ParseInput(PressedKey: Cardinal; CharCode: UCS4Char; PressedDown: Boolean): Boolean; override;
+ function ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean; override;
procedure onShow; override;
procedure SetAnimationProgress(Progress: real); override;
end;
@@ -119,10 +118,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
@@ -219,19 +218,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 // to-do : Party
- if (Num-1 >= {PartySession.Teams.NumTeams}0) then
+ J: byte;
+ begin
+ if (Num-1 >= PartySession.Teams.NumTeams) then
exit;
- {//Create Players Array
+ //Create Players array
SetLength(Players, PartySession.Teams.TeamInfo[Num-1].NumPlayers);
- For J := 0 to PartySession.Teams.TeamInfo[Num-1].NumPlayers-1 do
- Players[J] := String(PartySession.Teams.TeamInfo[Num-1].PlayerInfo[J].Name);}
+ 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);
@@ -239,193 +238,191 @@ var
begin
inherited;
- // to-do : Party
- //PartySession.StartRound;
+ PartySession.StartRound;
//Set Visibility of Round Infos
- // to-do : Party
- I := {Length(PartySession.Rounds)}0;
+ I := Length(PartySession.Rounds);
if (I >= 1) then
begin
- Static[StaticRound1].Visible := True;
- 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
@@ -434,26 +431,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 74c51b15..b7226a5e 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,12 +137,11 @@ 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 );
@@ -171,8 +170,7 @@ begin
PlaylistMan.CurPlayList := Playlist2;
//Start Party
- // to-do : Party
- //PartySession.StartNewParty(Rounds + 2);
+ PartySession.StartNewParty(Rounds + 2);
AudioPlayback.PlaySound(SoundLib.Start);
//Go to Player Screen
@@ -258,7 +256,8 @@ 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 3e453058..9f40983a 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,9 +79,11 @@ 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;
+ SDL_ModState: word;
+ I, J: integer;
+
procedure IntNext;
begin
repeat
@@ -245,7 +247,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);
@@ -256,8 +258,8 @@ begin
end;
end;
- AudioPlayback.PlayStart;
- FadeTo(@ScreenPartyNewRound);}
+ AudioPlayback.PlaySound(SoundLib.Start);
+ FadeTo(@ScreenPartyNewRound);
end;
// Up and Down could be done at the same time,
@@ -272,8 +274,6 @@ 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 5934a389..6b6d98e6 100644
--- a/unicode/src/screens/UScreenPartyScore.pas
+++ b/unicode/src/screens/UScreenPartyScore.pas
@@ -44,32 +44,32 @@ uses
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,22 +106,21 @@ begin
SDLK_BACKSPACE :
begin
AudioPlayback.PlaySound(SoundLib.Start);
- {if (PartySession.CurRound < High(PartySession.Rounds)) then
+ if (PartySession.CurRound < High(PartySession.Rounds)) then
FadeTo(@ScreenPartyNewRound)
- else // to-do : Party
+ else
begin
- PartySession.EndRound; }
+ PartySession.EndRound;
FadeTo(@ScreenPartyWin);
- //end;
+ end;
end;
SDLK_RETURN:
begin
AudioPlayback.PlaySound(SoundLib.Start);
- // to-do : Party
- {if (PartySession.CurRound < High(PartySession.Rounds)) then
+ if (PartySession.CurRound < High(PartySession.Rounds)) then
FadeTo(@ScreenPartyNewRound)
- else }
+ else
FadeTo(@ScreenPartyWin);
end;
end;
@@ -132,8 +131,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;
@@ -198,12 +197,11 @@ end;
procedure TScreenPartyScore.onShow;
var
- I, J: Integer;
- Placings: Array [0..5] of Byte;
+ I, J: integer;
+ Placings: array [0..5] of byte;
begin
inherited;
-
//Get Maxscore
MaxScore := 0;
@@ -218,11 +216,10 @@ begin
begin
Placings[I] := 0;
for J := 0 to ScreenSingModi.PlayerInfo.NumPlayers - 1 do
- If (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then
+ if (ScreenSingModi.PlayerInfo.Playerinfo[J].Score > ScreenSingModi.PlayerInfo.Playerinfo[I].Score) then
Inc(Placings[I]);
end;
-
//Set Static Length
Static[StaticTeam1].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[0].Percentage / 100;
Static[StaticTeam2].Texture.ScaleW := ScreenSingModi.PlayerInfo.Playerinfo[1].Percentage / 100;
@@ -233,16 +230,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 // to-do : Party
- //PartySession.EndRound;
+ //End Last Round
+ PartySession.EndRound;
//Set Winnertext
- //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]);
+ Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.GetWinnerString(PartySession.CurRound)]);
if (ScreenSingModi.PlayerInfo.NumPlayers >= 1) then
begin
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
@@ -253,25 +250,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
@@ -282,25 +279,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
@@ -311,19 +308,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 dc3c5ac0..af175f6e 100644
--- a/unicode/src/screens/UScreenPartyWin.pas
+++ b/unicode/src/screens/UScreenPartyWin.pas
@@ -44,25 +44,25 @@ uses
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; // Auto Removed, Unused Variable
-// Placing: Integer; // Auto Removed, Unused Variable
+var
+ I: integer;
+ Placing: TeamOrderArray;
- Function GetTeamColor(Team: Byte): Cardinal;
+ Function GetTeamColor(Team: byte): cardinal;
var
- NameString: String;
+ NameString: string;
begin
NameString := 'P' + InttoStr(Team+1) + 'Dark';
@@ -154,25 +154,24 @@ procedure TScreenPartyWin.onShow;
begin
inherited;
- // to-do : Party
//Get Team Placing
- //Placing := PartySession.GetTeamOrder;
+ Placing := PartySession.GetTeamOrder;
//Set Winnertext
- //Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]);
- {if (PartySession.Teams.NumTeams >= 1) then
+ Text[TextWinner].Text := Format(Language.Translate('PARTY_SCORE_WINS'), [PartySession.Teams.Teaminfo[Placing[0]].Name]);
+ if (PartySession.Teams.NumTeams >= 1) then
begin
Text[TextScoreTeam1].Text := InttoStr(PartySession.Teams.TeamInfo[Placing[0]].Score);
- Text[TextNameTeam1].Text := String(PartySession.Teams.TeamInfo[Placing[0]].Name);
+ 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
@@ -183,7 +182,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
@@ -196,26 +195,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
@@ -226,7 +225,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
@@ -239,26 +238,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
@@ -269,7 +268,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
@@ -282,12 +281,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 74107117..c8b8a743 100644
--- a/unicode/src/screens/UScreenPopup.pas
+++ b/unicode/src/screens/UScreenPopup.pas
@@ -44,34 +44,33 @@ uses
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
@@ -86,10 +85,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
@@ -105,9 +104,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;
@@ -124,14 +123,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;
@@ -173,15 +172,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');
@@ -191,10 +190,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
@@ -206,13 +205,13 @@ begin
SDLK_ESCAPE,
SDLK_BACKSPACE :
begin
- Visible:=False;
+ Visible := false;
Result := false;
end;
SDLK_RETURN:
begin
- Visible:=False;
+ Visible := false;
Result := false;
end;
@@ -242,7 +241,7 @@ end;
function TScreenPopupError.Draw: boolean;
begin
- Draw:=inherited Draw;
+ Draw := inherited Draw;
end;
procedure TScreenPopupError.onShow;
@@ -255,26 +254,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 5c312938..c337e5a5 100644
--- a/unicode/src/screens/UScreenScore.pas
+++ b/unicode/src/screens/UScreenScore.pas
@@ -129,6 +129,7 @@ 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;
@@ -193,6 +194,15 @@ begin
end;
end;
+function TScreenScore.ParseMouse(MouseButton: Integer; BtnDown: Boolean; X, Y: integer): boolean;
+begin
+ Result := True;
+ if (MouseButton = SDL_BUTTON_LEFT) and BtnDown then begin
+ //left-click anywhere sends return
+ ParseInput(SDLK_RETURN, #0, true);
+ end;
+end;
+
constructor TScreenScore.Create;
var
Player: integer;
diff --git a/unicode/src/screens/UScreenSing.pas b/unicode/src/screens/UScreenSing.pas
index 05683c83..dc3d5f5f 100644
--- a/unicode/src/screens/UScreenSing.pas
+++ b/unicode/src/screens/UScreenSing.pas
@@ -58,9 +58,8 @@ type
type
TScreenSing = class(TMenu)
- private
- VideoLoaded: boolean;
protected
+ VideoLoaded: boolean;
Paused: boolean; // pause mod
LyricsSync: TLyricsSyncSource;
NumEmptySentences: integer;
@@ -128,6 +127,7 @@ uses
UNote,
URecord,
USong,
+ UDisplay,
UUnicodeUtils;
// method for input parsing. if false is returned, getnextwindow
@@ -255,6 +255,9 @@ constructor TScreenSing.Create;
begin
inherited Create;
+ //too dangerous, a mouse button is quickly pressed by accident
+ RightMbESC := false;
+
fShowVisualization := false;
fCurrentVideoPlaybackEngine := VideoPlayback;
@@ -299,8 +302,8 @@ begin
Static[StaticPausePopup].Visible := false;
Lyrics := TLyricEngine.Create(
- Skin_LyricsUpperX, Skin_LyricsUpperY, Skin_LyricsUpperW, Skin_LyricsUpperH,
- Skin_LyricsLowerX, Skin_LyricsLowerY, Skin_LyricsLowerW, Skin_LyricsLowerH);
+ Theme.LyricBar.UpperX, Theme.LyricBar.UpperY, Theme.LyricBar.UpperW, Theme.LyricBar.UpperH,
+ Theme.LyricBar.LowerX, Theme.LyricBar.LowerY, Theme.LyricBar.LowerW, Theme.LyricBar.LowerH);
LyricsSync := TLyricsSyncSource.Create();
end;
@@ -625,6 +628,9 @@ end;
procedure TScreenSing.onShowFinish;
begin
+ // hide cursor on singscreen show
+ Display.SetCursor;
+
// start lyrics
LyricsState.Resume();
@@ -645,6 +651,7 @@ begin
end;
Background.OnFinish;
+ Display.SetCursor;
end;
function TScreenSing.Draw: boolean;
@@ -745,10 +752,9 @@ begin
begin
// Just call this once
// when Screens = 2
- If (ScreenAct = 1) then
+ if (ScreenAct = 1) then
fCurrentVideoPlaybackEngine.GetFrame(CurrentSong.VideoGAP + LyricsState.GetCurrentTime());
-
fCurrentVideoPlaybackEngine.DrawGL(ScreenAct);
end;
end;
diff --git a/unicode/src/screens/UScreenSingModi.pas b/unicode/src/screens/UScreenSingModi.pas
index b9c9365d..fbebe1ec 100644
--- a/unicode/src/screens/UScreenSingModi.pas
+++ b/unicode/src/screens/UScreenSingModi.pas
@@ -33,74 +33,45 @@ interface
{$I switches.inc}
-
-uses UMenu,
- UMusic,
- SDL,
- SysUtils,
- UFiles,
- UTime,
- USongs,
- UIni,
- ULog,
- UTexture,
- ULyrics,
- TextGL,
- gl,
-
- UThemes,
- UScreenSing,
- ModiSDK;
+uses
+ UMenu,
+ UMusic,
+ SDL,
+ SysUtils,
+ UFiles,
+ UTime,
+ USongs,
+ UIni,
+ ULog,
+ UTexture,
+ ULyrics,
+ TextGL,
+ gl,
+
+ UThemes,
+ UScreenSing,
+ ModiSDK;
type
TScreenSingModi = class(TScreenSing)
protected
- //paused: boolean; //Pause Mod
- //PauseTime: Real;
- //NumEmptySentences: integer;
+
public
- //TextTime: integer;
-
- //StaticP1: integer;
- //StaticP1ScoreBG: integer;
- //TextP1: integer;
- //TextP1Score: integer;
-
- //StaticP2R: integer;
- //StaticP2RScoreBG: integer;
- //TextP2R: integer;
- //TextP2RScore: integer;
-
- //StaticP2M: integer;
- //StaticP2MScoreBG: integer;
- //TextP2M: integer;
- //TextP2MScore: integer;
-
- //StaticP3R: integer;
- //StaticP3RScoreBG: integer;
- //TextP3R: integer;
- //TextP3RScore: integer;
-
- //Tex_Background: TTexture;
- //FadeOut: boolean;
- //LyricMain: TLyric;
- //LyricSub: TLyric;
- Winner: Byte; //Who Wins
+ 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: cCardinal; 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;
@@ -109,11 +80,19 @@ var
CustomSounds: array of TCustomSoundEntry;
//Procedured for Plugin
-function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall;
-//function Translate (const Name: PChar): PChar; stdcall;
-procedure Print (const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
-function LoadSound (const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
-procedure PlaySound (const Index: Cardinal); stdcall; //Plays a Custom Sound
+function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture;
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+//function Translate (const Name: PChar): PChar;
+// {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+//Procedure to Print Text
+procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar);
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+//Procedure that loads a Custom Sound
+function LoadSound(const Name: PChar): cardinal;
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
+//Plays a Custom Sound
+procedure PlaySound(const Index: cardinal);
+ {$IFDEF MSWINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
//Utilys
function ToSentences(Const Lines: TLines): TSentences;
@@ -133,12 +112,12 @@ uses
URecord,
USkins;
-// Method for input parsing. If False is returned, GetNextWindow
+// Method for input parsing. If false is returned, GetNextWindow
// should be checked to know the next window to load;
-function TScreenSingModi.ParseInput(PressedKey: Cardinal; CharCode: 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
@@ -164,7 +143,7 @@ end;
function ToSentences(Const Lines: TLines): TSentences;
var
- I, J: Integer;
+ I, J: integer;
begin
Result.Current := Lines.Current;
Result.High := Lines.High;
@@ -199,7 +178,7 @@ end;
procedure TScreenSingModi.onShow;
var
- I: Integer;
+ I: integer;
begin
inherited;
@@ -221,14 +200,14 @@ begin
PlayerInfo.Playerinfo[I].Name := PChar(Ini.Name[I]);
PlayerInfo.Playerinfo[I].Score := 0;
PlayerInfo.Playerinfo[I].Bar := 50;
- PlayerInfo.Playerinfo[I].Enabled := True;
+ PlayerInfo.Playerinfo[I].Enabled := true;
end;
for I := PlayerInfo.NumPlayers to high(PlayerInfo.Playerinfo) do
begin
PlayerInfo.Playerinfo[I].Score:= 0;
PlayerInfo.Playerinfo[I].Bar := 0;
- PlayerInfo.Playerinfo[I].Enabled := False;
+ PlayerInfo.Playerinfo[I].Enabled := false;
end;
{Case PlayersPlay of
@@ -275,18 +254,22 @@ 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
- {if PlayersPlay = 1 then begin
+ Scores.Visible := DLLMan.Selected.ShowScore;
+
+ {if PlayersPlay = 1 then
+ begin
Text[TextP1Score].Visible := DLLMan.Selected.ShowScore;
Static[StaticP1ScoreBG].Visible := DLLMan.Selected.ShowScore;
end;
- if (PlayersPlay = 2) OR (PlayersPlay = 4) then begin
+ if (PlayersPlay = 2) or (PlayersPlay = 4) then
+ begin
Text[TextP1TwoPScore].Visible := DLLMan.Selected.ShowScore;
Static[StaticP1TwoPScoreBG].Visible := DLLMan.Selected.ShowScore;
@@ -294,7 +277,8 @@ begin
Static[StaticP2RScoreBG].Visible := DLLMan.Selected.ShowScore;
end;
- if (PlayersPlay = 3) OR (PlayersPlay = 6) then begin
+ if (PlayersPlay = 3) or (PlayersPlay = 6) then
+ begin
Text[TextP1ThreePScore].Visible := DLLMan.Selected.ShowScore;
Static[StaticP1ThreePScoreBG].Visible := DLLMan.Selected.ShowScore;
@@ -330,116 +314,39 @@ begin
end;
end;
- //Show Score
- if DLLMan.Selected.ShowScore then
- begin
- {//ScoreBG Mod
- // set player colors
- if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
-
-
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
-
-
-
- end;
- if ScreenAct = 2 then begin
- LoadColor(Static[StaticP1TwoP].Texture.ColR, Static[StaticP1TwoP].Texture.ColG,
- Static[StaticP1TwoP].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2R].Texture.ColR, Static[StaticP2R].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P4Dark');
-
-
-
- LoadColor(Static[StaticP1TwoPScoreBG].Texture.ColR, Static[StaticP1TwoPScoreBG].Texture.ColG,
- Static[StaticP1TwoPScoreBG].Texture.ColB, 'P3Dark');
- LoadColor(Static[StaticP2RScoreBG].Texture.ColR, Static[StaticP2RScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P4Dark');
-
-
-
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P3Dark');
-
-
-
- LoadColor(Static[StaticP1ThreePScoreBG].Texture.ColR, Static[StaticP1ThreePScoreBG].Texture.ColG,
- Static[StaticP1ThreePScoreBG].Texture.ColB, 'P1Dark');
- LoadColor(Static[StaticP2MScoreBG].Texture.ColR, Static[StaticP2MScoreBG].Texture.ColG,
- Static[StaticP2RScoreBG].Texture.ColB, 'P2Dark');
- LoadColor(Static[StaticP3RScoreBG].Texture.ColR, Static[StaticP3RScoreBG].Texture.ColG,
- Static[StaticP3RScoreBG].Texture.ColB, 'P3Dark');
-
-
-
- end;
- if ScreenAct = 2 then begin
- LoadColor(Static[StaticP1ThreeP].Texture.ColR, Static[StaticP1ThreeP].Texture.ColG,
- Static[StaticP1ThreeP].Texture.ColB, 'P4Dark');
- LoadColor(Static[StaticP2M].Texture.ColR, Static[StaticP2M].Texture.ColG,
- Static[StaticP2R].Texture.ColB, 'P5Dark');
- LoadColor(Static[StaticP3R].Texture.ColR, Static[StaticP3R].Texture.ColG,
- Static[StaticP3R].Texture.ColB, 'P6Dark');
-
-
-
+ Background.Draw;
- 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;
+ // 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;
- 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
+ // set player names (for 2 screens and only Singstar skin)
+ if ScreenAct = 1 then
+ begin
+ Text[TextP1].Text := 'P1';
+ Text[TextP1TwoP].Text := 'P1'; // added for ps3 skin
+ Text[TextP1ThreeP].Text := 'P1'; // added for ps3 skin
+ Text[TextP2R].Text := 'P2';
+ Text[TextP2M].Text := 'P2';
+ Text[TextP3R].Text := 'P3';
+ end
+ Else if ScreenAct = 2 then
+ begin
+ case PlayersPlay of
+ 4: begin
+ Text[TextP1TwoP].Text := 'P3';
+ Text[TextP2R].Text := 'P4';
+ end;
+ 6: begin
+ Text[TextP1ThreeP].Text := 'P4';
+ Text[TextP2M].Text := 'P5';
+ Text[TextP3R].Text := 'P6';
+ end;
+ end; // case
+ end; // if
// stereo <- and where iss P2M? or P3?
Static[StaticP1].Texture.X := Static[StaticP1].Texture.X + 10*ScreenX;
@@ -451,92 +358,6 @@ begin
Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X + 10*ScreenX;
Text[TextP2R].X := Text[TextP2R].X + 10*ScreenX;
- {Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X + 10*ScreenX;
- Text[TextP2RScore].X := Text[TextP2RScore].X + 10*ScreenX;}
-
- // .. and scores
- {if PlayersPlay = 1 then begin
- TextStr := IntToStr(Player[0].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1Score].Text := TextStr;
- end;
-
- if PlayersPlay = 2 then begin
- TextStr := IntToStr(Player[0].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1TwoPScore].Text := TextStr;
-
- TextStr := IntToStr(Player[1].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2RScore].Text := TextStr;
- end;
-
- if PlayersPlay = 3 then begin
- TextStr := IntToStr(Player[0].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1ThreePScore].Text := TextStr;
-
- TextStr := IntToStr(Player[1].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2MScore].Text := TextStr;
-
- TextStr := IntToStr(Player[2].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP3RScore].Text := TextStr;
- end;
-
- if PlayersPlay = 4 then begin
- if ScreenAct = 1 then begin
- TextStr := IntToStr(Player[0].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1TwoPScore].Text := TextStr;
-
- TextStr := IntToStr(Player[1].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2RScore].Text := TextStr;
- end;
- if ScreenAct = 2 then begin
- TextStr := IntToStr(Player[2].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1TwoPScore].Text := TextStr;
-
- TextStr := IntToStr(Player[3].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2RScore].Text := TextStr;
- end;
- end;
-
- if PlayersPlay = 6 then begin
- if ScreenAct = 1 then begin
- TextStr := IntToStr(Player[0].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1ThreePScore].Text := TextStr;
-
- TextStr := IntToStr(Player[1].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2MScore].Text := TextStr;
-
- TextStr := IntToStr(Player[2].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP3RScore].Text := TextStr;
- end;
- if ScreenAct = 2 then begin
- TextStr := IntToStr(Player[3].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP1ThreePScore].Text := TextStr;
-
- TextStr := IntToStr(Player[4].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP2MScore].Text := TextStr;
-
- TextStr := IntToStr(Player[5].ScoreTotalI);
- while Length(TextStr) < 5 do TextStr := '0' + TextStr;
- Text[TextP3RScore].Text := TextStr;
- end;
- end; }
-
- end; //ShowScore
-
for S := 1 to 1 do
Static[S].Texture.X := Static[S].Texture.X + 10*ScreenX;
@@ -557,30 +378,43 @@ 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);
@@ -596,6 +430,9 @@ begin
GoldenRec.SpawnRec;
//GoldenNoteStarsTwinkle Mod
+ //Draw Score
+ Scores.Draw;
+
//Update PlayerInfo
for I := 0 to PlayerInfo.NumPlayers-1 do
begin
@@ -606,14 +443,15 @@ begin
end;
end;
- if ((ShowFinish) AND (NOT Paused)) then
+ if ((ShowFinish) and (not Paused)) then
begin
if not DLLMan.PluginDraw(Playerinfo, Lines[0].Current) then
begin
- if not FadeOut then begin
- Finish;
- FadeOut := true;
- FadeTo(@ScreenPartyScore);
+ if not FadeOut then
+ begin
+ Finish;
+ FadeOut := true;
+ FadeTo(@ScreenPartyScore);
end;
end;
end;
@@ -637,14 +475,12 @@ begin
{Static[StaticP1ScoreBG].Texture.X := Static[StaticP1ScoreBG].Texture.X - 10*ScreenX;
Text[TextP1Score].X := Text[TextP1Score].X - 10*ScreenX;}
-
Static[StaticP2R].Texture.X := Static[StaticP2R].Texture.X - 10*ScreenX;
Text[TextP2R].X := Text[TextP2R].X - 10*ScreenX;
{Static[StaticP2RScoreBG].Texture.X := Static[StaticP2RScoreBG].Texture.X - 10*ScreenX;
Text[TextP2RScore].X := Text[TextP2RScore].X - 10*ScreenX;}
-
for S := 1 to 1 do
Static[S].Texture.X := Static[S].Texture.X - 10*ScreenX;
@@ -665,13 +501,13 @@ Winner := DllMan.PluginFinish(PlayerInfo);
//DLLMan.UnLoadPlugin;
end;
-function LoadTex (const Name: PChar; Typ: TTextureType): TsmallTexture; stdcall;
+function LoadTex(const Name: PChar; Typ: TTextureType): TsmallTexture;
var
- Texname, EXT: String;
+ 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
@@ -688,10 +524,11 @@ end;
{
function Translate (const Name: PChar): PChar; stdcall;
begin
- Result := PChar(Language.Translate(String(Name)));
+ Result := PChar(Language.Translate(string(Name)));
end; }
-procedure Print(const Style, Size: Byte; const X, Y: Real; const Text: PChar); stdcall; //Procedure to Print Text
+//Procedure to Print Text
+procedure Print(const Style, Size: byte; const X, Y: real; const Text: PChar);
begin
SetFontItalic ((Style and 128) = 128);
SetFontStyle(Style and 7);
@@ -699,14 +536,15 @@ begin
// used by Hold_The_Line / TeamDuell
SetFontSize(Size);
SetFontPos (X, Y);
- glPrint (Language.Translate(String(Text)));
+ glPrint (Language.Translate(string(Text)));
end;
-function LoadSound(const Name: PChar): Cardinal; stdcall; //Procedure that loads a Custom Sound
+//Procedure that loads a Custom Sound
+function LoadSound(const Name: PChar): cardinal;
var
Stream: TAudioPlaybackStream;
- i: Integer;
- Filename: String;
+ i: integer;
+ Filename: string;
begin
//Search for Sound in already loaded Sounds
Filename := UpperCase(SoundPath + Name);
@@ -719,7 +557,7 @@ begin
end;
end;
- Stream := AudioPlayback.OpenSound(SoundPath + String(Name));
+ Stream := AudioPlayback.OpenSound(SoundPath + string(Name));
if (Stream = nil) then
begin
Result := 0;
@@ -731,7 +569,8 @@ begin
Result := High(CustomSounds);
end;
-procedure PlaySound(const Index: Cardinal); stdcall; //Plays a Custom Sound
+//Plays a Custom Sound
+procedure PlaySound(const Index: cardinal);
begin
if (Index <= High(CustomSounds)) then
AudioPlayback.PlaySound(CustomSounds[Index].Stream);
diff --git a/unicode/src/screens/UScreenSong.pas b/unicode/src/screens/UScreenSong.pas
index da725a59..5d9d730c 100644
--- a/unicode/src/screens/UScreenSong.pas
+++ b/unicode/src/screens/UScreenSong.pas
@@ -33,24 +33,23 @@ interface
{$I switches.inc}
-
uses
- UMenu,
- SDL,
- UMusic,
- UFiles,
- UTime,
- UDisplay,
- USongs,
SysUtils,
+ SDL,
UCommon,
- ULog,
- UThemes,
- UTexture,
+ UDisplay,
+ UFiles,
+ UIni,
ULanguage,
+ ULog,
+ UMenu,
+ UMenuEqualizer,
+ UMusic,
USong,
- UIni,
- UMenuEqualizer;
+ USongs,
+ UTexture,
+ UThemes,
+ UTime;
type
TScreenSong = class(TMenu)
@@ -111,7 +110,6 @@ type
StaticNonParty: array of cardinal;
TextNonParty: array of cardinal;
-
constructor Create; override;
procedure SetScroll;
//procedure SetScroll1;
@@ -121,6 +119,7 @@ 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;
@@ -142,7 +141,7 @@ type
//procedures for Menu
procedure StartSong;
procedure OpenEditor;
- procedure DoJoker(Team: Byte);
+ procedure DoJoker(Team: byte);
procedure SelectPlayers;
procedure UnloadDetailedCover;
@@ -178,7 +177,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);
@@ -199,7 +198,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);
@@ -243,14 +242,13 @@ begin
end;
//Show Cat in Top Left Mod End
-
-// Method for input parsing. If False is returned, GetNextWindow
+// Method for input parsing. If false is returned, GetNextWindow
// should be checked to know the next window to load;
function TScreenSong.ParseInput(PressedKey: cardinal; CharCode: UCS4Char; PressedDown: boolean): boolean;
var
I: integer;
I2: integer;
- SDL_ModState: Word;
+ SDL_ModState: word;
UpperLetter: UCS4Char;
TempStr: UTF8String;
begin
@@ -286,7 +284,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
@@ -309,7 +307,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
@@ -407,25 +405,25 @@ begin
if (Songs.SongList.Count > 0) and
(Mode = smNormal) then
begin
- if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then //Random Category
+ if (SDL_ModState = KMOD_LSHIFT) and (Ini.TabsAtStartup = 1) then // random category
begin
- I2 := 0; //Count Cats
- for I:= 0 to high(CatSongs.Song) do
+ I2 := 0; // count cats
+ for I := 0 to High(CatSongs.Song) do
begin
if CatSongs.Song[I].Main then
Inc(I2);
end;
- I2 := Random(I2)+1; //Zufall
+ I2 := Random(I2 + 1); // random and include I2
- //Find Cat:
- for I:= 0 to high(CatSongs.Song) do
+ // find cat:
+ for I := 0 to High(CatSongs.Song) do
begin
if CatSongs.Song[I].Main then
Dec(I2);
- if (I2<=0) then
+ if (I2 <= 0) then
begin
- //Show Cat in Top Left Mod
+ // show cat in top left mod
ShowCatTL (I);
Interaction := I;
@@ -438,38 +436,38 @@ begin
end;
end;
end
- else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then //random in All Categorys
+ else if (SDL_ModState = KMOD_LCTRL) and (Ini.TabsAtStartup = 1) then // random in all categories
begin
repeat
- I2 := Random(high(CatSongs.Song)+1) + 1;
+ I2 := Random(High(CatSongs.Song) + 1);
until (not CatSongs.Song[I2].Main);
- //Search Cat
+ // search cat
for I := I2 downto 0 do
begin
if CatSongs.Song[I].Main then
break;
end;
- //In I is now the categorie in I2 the song
+ // in I is now the categorie in I2 the song
- //Choose Cat
+ // choose cat
CatSongs.ShowCategoryList;
- //Show Cat in Top Left Mod
+ // show cat in top left mod
ShowCatTL (I);
CatSongs.ClickCategoryButton(I);
SelectNext;
- //Fix: Not Existing Song selected:
- //if (I+1=I2) then
- 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;
@@ -501,7 +499,7 @@ begin
break;
end;
if (I <= 1) then
- Interaction := high(CatSongs.Song)
+ Interaction := High(CatSongs.Song)
else
Interaction := I - 1;
@@ -513,7 +511,6 @@ begin
//Show Cat in Top Left Mod
HideCatTL;
-
//Show Wrong Song when Tabs on Fix
SelectNext;
FixSelected;
@@ -619,13 +616,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;
@@ -661,15 +658,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;
@@ -715,41 +712,61 @@ begin
end;
SDLK_1:
- begin //Joker // to-do : Party
- {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then
+ begin //Joker
+ if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0) then
begin
//Use Joker
Dec(PartySession.Teams.Teaminfo[0].Joker);
SelectRandomSong;
SetJoker;
- end; }
+ end;
end;
SDLK_2:
begin //Joker
- {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then
+ if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0) then
begin
//Use Joker
Dec(PartySession.Teams.Teaminfo[1].Joker);
SelectRandomSong;
SetJoker;
- end; }
+ end;
end;
SDLK_3:
begin //Joker
- {if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then
+ if (Mode = smPartyMode) and (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0) then
begin
//Use Joker
Dec(PartySession.Teams.Teaminfo[2].Joker);
SelectRandomSong;
SetJoker;
- end; }
+ end;
end;
end;
end; // if (PressedDown)
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;
@@ -811,7 +828,6 @@ begin
GenerateThumbnails();
-
// Randomize Patch
Randomize;
@@ -966,7 +982,6 @@ begin
if CatSongs.Song[B].Visible then
Inc(VisInt);
-
if VisCount <= 6 then
begin
Typ := 0;
@@ -995,7 +1010,6 @@ begin
end;
-
// hide all buttons
for B := 0 to High(Button) do
begin
@@ -1013,7 +1027,6 @@ begin
end;
}
-
if Typ = 0 then
begin
for B := 0 to High(Button) do
@@ -1310,27 +1323,26 @@ begin
if Button[B].Visible then // optimization for 1000 songs - updates only visible songs, hiding in tabs becomes useful for maintaing good speed
begin
- Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
-
- Z := (1 + cos(Factor)) / 2;
- Z2 := (1 + 2*Z) / 3;
+ Factor := 2 * pi * (CatSongs.VisibleIndex(B) - SongCurrent) / VS {CatSongs.VisibleSongs};// 0.5.0 (II): takes another 16ms
+ Z := (1 + cos(Factor)) / 2;
+ Z2 := (1 + 2*Z) / 3;
- Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
- Button[B].Z := Z / 2 + 0.3;
+ Button[B].Y := Theme.Song.Cover.Y + (0.185 * Theme.Song.Cover.H * VS * sin(Factor)) * Z2 - ((Button[B].H - Theme.Song.Cover.H)/2); // 0.5.0 (I): 2 times faster by not calling CatSongs.VisibleSongs
+ Button[B].Z := Z / 2 + 0.3;
- Button[B].W := Theme.Song.Cover.H * Z2;
+ Button[B].W := Theme.Song.Cover.H * Z2;
- //Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
- Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
- Button[B].H := Button[B].W;
+ //Button[B].Y := {50 +} 140 + 50 - 50 * Z2;
+ Button[B].X := Theme.Song.Cover.X + (Theme.Song.Cover.H - Abs(Button[B].H)) * 0.7 ;
+ Button[B].H := Button[B].W;
end;
end;
end
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
@@ -1358,7 +1370,6 @@ begin
Diff := (Button[B].H - Theme.Song.Cover.H)/2;
-
X := Sin(Angle*1.3)*0.9;
Button[B].Y := Theme.Song.Cover.Y + Theme.Song.Cover.W * X - Diff;
@@ -1368,9 +1379,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
@@ -1388,7 +1399,6 @@ begin
Button[B].X := Theme.Song.Cover.X - (Button[B].H - Theme.Song.Cover.H)*0.5;
-
Button[B].DeSelectReflectionspacing := 15 * Button[B].H/Theme.Song.Cover.H;
Button[B].Y := Theme.Song.Cover.Y+Theme.Song.Cover.H/2-Button[b].H/2+Theme.Song.Cover.W/320*(Theme.Song.Cover.H*sin(Angle/2)*1.52);
@@ -1398,7 +1408,6 @@ begin
end;
end;
-
procedure TScreenSong.onShow;
begin
inherited;
@@ -1462,7 +1471,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)
@@ -1722,41 +1731,40 @@ var
I, I2: integer;
begin
case PlaylistMan.Mode of
- smNormal: //All Songs Just Select Random Song
+ smNormal: // all songs just select random song
begin
- //When Tabs are activated then use Tab Method
+ // when tabs are activated then use tab method
if (Ini.TabsAtStartup = 1) then
begin
repeat
- I2 := Random(high(CatSongs.Song)+1) - low(CatSongs.Song)+1;
+ I2 := Low(CatSongs.Song) + Random(High(CatSongs.Song) + 1 - Low(CatSongs.Song));
until CatSongs.Song[I2].Main = false;
- //Search Cat
- for I := I2 downto low(CatSongs.Song) do
+ // search cat
+ for I := I2 downto Low(CatSongs.Song) do
begin
if CatSongs.Song[I].Main then
break;
end;
- //In I ist jetzt die Kategorie in I2 der Song
- //I is the CatNum, I2 is the No of the Song within this Cat
+ // I is the cat number, I2 is the no of the song within this cat
- //Choose Cat
+ // choose cat
CatSongs.ShowCategoryList;
- //Show Cat in Top Left Mod
- ShowCatTL (I);
+ // show cat in top left mod
+ ShowCatTL(I);
CatSongs.ClickCategoryButton(I);
SelectNext;
- //Choose Song
- SkipTo(I2-I);
+ // choose song
+ SkipTo(I2 - I);
end
- //When Tabs are deactivated use easy Method
+ // when tabs are deactivated use easy method
else
SkipTo(Random(CatSongs.VisibleSongs));
end;
- smPartyMode: //One Category Select Category and Select Random Song
+ smPartyMode: // one category select category and select random song
begin
CatSongs.ShowCategoryList;
CatSongs.ClickCategoryButton(PlaylistMan.CurPlayList);
@@ -1767,7 +1775,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);
@@ -1784,10 +1792,8 @@ end;
procedure TScreenSong.SetJoker;
begin
// If Party Mode
- // to-do : Party
if Mode = smPartyMode then //Show Joker that are available
begin
- (*
if (PartySession.Teams.NumTeams >= 1) then
begin
Static[StaticTeam1Joker1].Visible := (PartySession.Teams.Teaminfo[0].Joker >= 1);
@@ -1838,7 +1844,6 @@ begin
Static[StaticTeam3Joker4].Visible := false;
Static[StaticTeam3Joker5].Visible := false;
end;
- *)
end
else
begin //Hide all
@@ -1870,19 +1875,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;
@@ -1927,9 +1932,8 @@ 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
@@ -1939,7 +1943,6 @@ 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 b6979f63..87b31106 100644
--- a/unicode/src/screens/UScreenSongJumpto.pas
+++ b/unicode/src/screens/UScreenSongJumpto.pas
@@ -47,24 +47,24 @@ type
TScreenSongJumpto = class(TMenu)
private
//For ChangeMusic
- fLastPlayed: Integer;
- fVisible: Boolean;
+ fLastPlayed: integer;
+ fVisible: boolean;
fSelectType: TSongFilter;
- fVisSongs: Integer;
+ fVisSongs: integer;
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;
- property Visible: Boolean read fVisible write SetVisible;
+ property Visible: boolean read fVisible write SetVisible;
end;
implementation
@@ -76,14 +76,15 @@ uses
UTexture,
ULanguage,
UParty,
+ USongs,
UScreenSong,
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 +101,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 +111,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,15 +169,14 @@ 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;
@@ -197,7 +197,7 @@ begin
//Select Input
Interaction := 0;
- Button[0].Text[0].Selected := True;
+ Button[0].Text[0].Selected := true;
fLastPlayed := ScreenSong.Interaction;
end;
@@ -207,7 +207,7 @@ begin
Result := inherited Draw;
end;
-procedure TScreenSongJumpto.SetTextFound(Count: Cardinal);
+procedure TScreenSongJumpto.SetTextFound(Count: cardinal);
begin
if (Count = 0) then
begin
@@ -225,7 +225,6 @@ 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 b8720b86..e09dd9b5 100644
--- a/unicode/src/screens/UScreenSongMenu.pas
+++ b/unicode/src/screens/UScreenSongMenu.pas
@@ -196,7 +196,6 @@ begin
SetLength(ISelections, 1);
ISelections[0] := 'Dummy';
-
AddText(Theme.SongMenu.TextMenu);
LoadFromTheme(Theme.SongMenu);
@@ -402,19 +401,16 @@ begin
begin
CurMenu := sMenu;
Text[0].Text := Language.Translate('SONG_MENU_NAME_PARTY_JOKER');
- // to-do : Party
-{
- Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0);
+
+ Button[0].Visible := (PartySession.Teams.NumTeams >= 1) and (PartySession.Teams.Teaminfo[0].Joker > 0);
Button[1].Visible := (PartySession.Teams.NumTeams >= 2) and (PartySession.Teams.Teaminfo[1].Joker > 0);
Button[2].Visible := (PartySession.Teams.NumTeams >= 3) and (PartySession.Teams.Teaminfo[2].Joker > 0);
-}
Button[3].Visible := true;
SelectsS[0].Visible := false;
-{
- Button[0].Text[0].Text := String(PartySession.Teams.Teaminfo[0].Name);
- Button[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
@@ -425,10 +421,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 6241ee2e..5a0419b7 100644
--- a/unicode/src/screens/UScreenStatDetail.pas
+++ b/unicode/src/screens/UScreenStatDetail.pas
@@ -47,21 +47,20 @@ type
TScreenStatDetail = class(TMenu)
public
Typ: TStatType;
- Page: Cardinal;
- Count: Byte;
- Reversed: Boolean;
-
- TotEntrys: Cardinal;
- TotPages: Cardinal;
+ Page: cardinal;
+ Count: byte;
+ Reversed: boolean;
+ TotEntrys: cardinal;
+ TotPages: cardinal;
constructor Create; override;
- function ParseInput(PressedKey: Cardinal; CharCode: 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
@@ -74,10 +73,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
@@ -98,24 +97,28 @@ begin
end;
SDLK_RETURN:
begin
- if Interaction = 0 then begin
+ if Interaction = 0 then
+ begin
//Next Page
SetPage(Page+1);
end;
- if Interaction = 1 then begin
+ if Interaction = 1 then
+ begin
//Previous Page
if (Page > 0) then
SetPage(Page-1);
end;
- if Interaction = 2 then begin
+ if Interaction = 2 then
+ begin
//Reverse Order
Reversed := not Reversed;
SetPage(Page);
end;
- if Interaction = 3 then begin
+ if Interaction = 3 then
+ begin
AudioPlayback.PlaySound(SoundLib.Back);
FadeTo(@ScreenStatMain);
end;
@@ -188,7 +191,7 @@ begin
SetTitle;
//Show First Page
- Reversed := False;
+ Reversed := false;
SetPage(0);
end;
@@ -200,12 +203,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);
@@ -289,9 +292,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 a183f04c..6d4d3f5b 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 eaa90ab1..2ddca8ef 100644
--- a/unicode/src/screens/UScreenTop5.pas
+++ b/unicode/src/screens/UScreenTop5.pas
@@ -57,6 +57,7 @@ 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;
@@ -74,7 +75,7 @@ uses
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
@@ -92,7 +93,7 @@ begin
SDLK_RETURN:
begin
if (not Fadeout) then
- begin
+ begin
FadeTo(@ScreenSong);
Fadeout := true;
end;
@@ -105,6 +106,16 @@ 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;
@@ -113,19 +124,16 @@ begin
LoadFromTheme(Theme.Top5);
-
- TextLevel := AddText(Theme.Top5.TextLevel);
+ TextLevel := AddText(Theme.Top5.TextLevel);
TextArtistTitle := AddText(Theme.Top5.TextArtistTitle);
for I := 0 to 4 do
- StaticNumber[I+1] := AddStatic( Theme.Top5.StaticNumber[I] );
-
- for I := 0 to 4 do
- TextNumber[I+1] := AddText(Theme.Top5.TextNumber[I]);
- for I := 0 to 4 do
- TextName[I+1] := AddText(Theme.Top5.TextName[I]);
- for I := 0 to 4 do
- TextScore[I+1] := AddText(Theme.Top5.TextScore[I]);
+ begin
+ StaticNumber[I+1] := AddStatic(Theme.Top5.StaticNumber[I]);
+ TextNumber[I+1] := AddText (Theme.Top5.TextNumber[I]);
+ TextName[I+1] := AddText (Theme.Top5.TextName[I]);
+ TextScore[I+1] := AddText (Theme.Top5.TextScore[I]);
+ end;
end;
@@ -162,7 +170,7 @@ begin
Text[TextScore[I]].Text := IntToStr(CurrentSong.Score[Ini.Difficulty, I-1].Score);
end;
- for I := Length(CurrentSong.Score[Ini.Difficulty])+1 to 5 do
+ for I := Length(CurrentSong.Score[Ini.Difficulty]) + 1 to 5 do
begin
Static[StaticNumber[I]].Visible := false;
Text[TextNumber[I]].Visible := false;
diff --git a/unicode/src/screens/UScreenWelcome.pas b/unicode/src/screens/UScreenWelcome.pas
index 4df2b6f7..b798629f 100644
--- a/unicode/src/screens/UScreenWelcome.pas
+++ b/unicode/src/screens/UScreenWelcome.pas
@@ -34,7 +34,10 @@ interface
{$I switches.inc}
uses
- UMenu, SDL, SysUtils, UThemes;
+ UMenu,
+ SDL,
+ SysUtils,
+ UThemes;
type
TScreenWelcome = class(TMenu)
@@ -42,24 +45,29 @@ type
Animation: real;
Fadeout: boolean;
constructor Create; override;
- function ParseInput(PressedKey: Cardinal; CharCode: 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
@@ -102,12 +110,14 @@ begin
// draw nothing
Min := 0; Max := 1000;
- if (Animation >= Min) and (Animation < Max) then begin
+ if (Animation >= Min) and (Animation < Max) then
+ begin
end;
// popup
Min := 1000; Max := 1120;
- if (Animation >= Min) and (Animation < Max) then begin
+ if (Animation >= Min) and (Animation < Max) then
+ begin
Factor := (Animation - Min) / (Max - Min);
Static[0].Texture.X := 600;
Static[0].Texture.Y := 600 - Factor * 230;
@@ -117,7 +127,8 @@ begin
// bounce
Min := 1120; Max := 1200;
- if (Animation >= Min) and (Animation < Max) then begin
+ if (Animation >= Min) and (Animation < Max) then
+ begin
Factor := (Animation - Min) / (Max - Min);
Static[0].Texture.Y := 370 + Factor * 50;
Static[0].Texture.H := 230 - Factor * 50;
@@ -125,14 +136,15 @@ begin
// run
Min := 1500; Max := 3500;
- if (Animation >= Min) and (Animation < Max) then begin
+ if (Animation >= Min) and (Animation < Max) then
+ begin
Factor := (Animation - Min) / (Max - Min);
Static[0].Texture.X := 600 - Factor * 1400;
Static[0].Texture.H := 180;
-
- for Count := 1 to 5 do begin
+ for Count := 1 to 5 do
+ begin
Static[Count].Texture.X := 770 - Factor * 1400;
Static[Count].Texture.W := 150 + Factor * 200;
Static[Count].Texture.Alpha := Factor * 0.5;
@@ -140,7 +152,8 @@ begin
end;
Min := 3500;
- if (Animation >= Min) and (not Fadeout) then begin
+ if (Animation >= Min) and (not Fadeout) then
+ begin
FadeTo(@ScreenMain);
Fadeout := true;
end;
diff --git a/unicode/src/ultrastardx.dpr b/unicode/src/ultrastardx.dpr
index 9bcc4aca..f6376365 100644
--- a/unicode/src/ultrastardx.dpr
+++ b/unicode/src/ultrastardx.dpr
@@ -203,6 +203,7 @@ 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',
@@ -215,22 +216,6 @@ 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
//------------------------------
@@ -254,7 +239,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',
@@ -342,8 +327,6 @@ 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;