aboutsummaryrefslogtreecommitdiffstats
path: root/unicode/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'unicode/src/base')
-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/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/UImage.pas41
-rw-r--r--unicode/src/base/UIni.pas272
-rw-r--r--unicode/src/base/UMain.pas89
-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/URecord.pas10
-rw-r--r--unicode/src/base/USingScores.pas646
-rw-r--r--unicode/src/base/USongs.pas180
-rw-r--r--unicode/src/base/UTexture.pas4
-rw-r--r--unicode/src/base/UThemes.pas33
-rw-r--r--unicode/src/base/UTime.pas28
20 files changed, 1236 insertions, 1322 deletions
diff --git a/unicode/src/base/UBeatTimer.pas b/unicode/src/base/UBeatTimer.pas
deleted file mode 100644
index a47a06f9..00000000
--- a/unicode/src/base/UBeatTimer.pas
+++ /dev/null
@@ -1,170 +0,0 @@
- {* UltraStar Deluxe - Karaoke Game
- *
- * UltraStar Deluxe is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; see the file COPYING. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- * $URL: https://ultrastardx.svn.sourceforge.net/svnroot/ultrastardx/trunk/src/base/USingNotes.pas $
- * $Id: USingNotes.pas 1406 2008-09-23 21:43:52Z k-m_schindler $
- *}
-
-unit UBeatTimer;
-
-interface
-
-{$IFDEF FPC}
- {$MODE Delphi}
-{$ENDIF}
-
-{$I switches.inc}
-
-uses
- UTime;
-
-type
- (**
- * TLyricsState contains all information concerning the
- * state of the lyrics, e.g. the current beat or duration of the lyrics.
- *)
- TLyricsState = class
- private
- Timer: TRelativeTimer; // keeps track of the current time
- public
- OldBeat: integer; // previous discovered beat
- CurrentBeat: integer; // current beat (rounded)
- MidBeat: real; // current beat (float)
-
- // now we use this for super synchronization!
- // only used when analyzing voice
- // TODO: change ...D to ...Detect(ed)
- OldBeatD: integer; // previous discovered beat
- CurrentBeatD: integer; // current discovered beat (rounded)
- MidBeatD: real; // current discovered beat (float)
-
- // we use this for audible clicks
- // TODO: Change ...C to ...Click
- OldBeatC: integer; // previous discovered beat
- CurrentBeatC: integer;
- MidBeatC: real; // like CurrentBeatC
-
- OldLine: integer; // previous displayed sentence
-
- StartTime: real; // time till start of lyrics (= Gap)
- TotalTime: real; // total song time
-
- constructor Create();
- procedure Pause();
- procedure Resume();
-
- procedure Reset();
- procedure UpdateBeats();
-
- (**
- * current song time (in seconds) used as base-timer for lyrics etc.
- *)
- function GetCurrentTime(): real;
- procedure SetCurrentTime(Time: real);
- end;
-
-implementation
-uses UNote, Math;
-
-
-constructor TLyricsState.Create();
-begin
- // create a triggered timer, so we can Pause() it, set the time
- // and Resume() it afterwards for better synching.
- Timer := TRelativeTimer.Create(true);
-
- // reset state
- Reset();
-end;
-
-procedure TLyricsState.Pause();
-begin
- Timer.Pause();
-end;
-
-procedure TLyricsState.Resume();
-begin
- Timer.Resume();
-end;
-
-procedure TLyricsState.SetCurrentTime(Time: real);
-begin
- // do not start the timer (if not started already),
- // after setting the current time
- Timer.SetTime(Time, false);
-end;
-
-function TLyricsState.GetCurrentTime(): real;
-begin
- Result := Timer.GetTime();
-end;
-
-(**
- * Resets the timer and state of the lyrics.
- * The timer will be stopped afterwards so you have to call Resume()
- * to start the lyrics timer.
- *)
-procedure TLyricsState.Reset();
-begin
- Pause();
- SetCurrentTime(0);
-
- StartTime := 0;
- TotalTime := 0;
-
- OldBeat := -1;
- MidBeat := -1;
- CurrentBeat := -1;
-
- OldBeatC := -1;
- MidBeatC := -1;
- CurrentBeatC := -1;
-
- OldBeatD := -1;
- MidBeatD := -1;
- CurrentBeatD := -1;
-end;
-
-(**
- * Updates the beat information (CurrentBeat/MidBeat/...) according to the
- * current lyric time.
- *)
-procedure TLyricsState.UpdateBeats();
-var
- CurLyricsTime: real;
-begin
- CurLyricsTime := GetCurrentTime();
-
- OldBeat := CurrentBeat;
- MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeat := Floor(MidBeat);
-
- OldBeatC := CurrentBeatC;
- MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeatC := Floor(MidBeatC);
-
- OldBeatD := CurrentBeatD;
- // MidBeatD = MidBeat with additional GAP
- MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000);
- CurrentBeatD := Floor(MidBeatD);
-end;
-
-end. \ No newline at end of file
diff --git a/unicode/src/base/UCommon.pas b/unicode/src/base/UCommon.pas
index 3230a065..f5697916 100644
--- a/unicode/src/base/UCommon.pas
+++ b/unicode/src/base/UCommon.pas
@@ -44,16 +44,16 @@ uses
ULog;
type
- TMessageType = (mtInfo, mtError);
+ TMessageType = ( mtInfo, mtError );
-procedure ShowMessage(const msg: string; msgType: TMessageType = mtInfo);
+procedure ShowMessage(const msg : String; msgType: TMessageType = mtInfo);
procedure ConsoleWriteLn(const msg: string);
function RWopsFromStream(Stream: TStream): PSDL_RWops;
{$IFDEF FPC}
-function RandomRange(aMin: integer; aMax: integer): integer;
+function RandomRange(aMin: Integer; aMax: Integer): Integer;
{$ENDIF}
procedure DisableFloatingPointExceptions();
@@ -61,8 +61,8 @@ procedure SetDefaultNumericLocale();
procedure RestoreNumericLocale();
{$IFNDEF MSWINDOWS}
- procedure ZeroMemory(Destination: pointer; Length: dword);
- function MakeLong(a, b: word): longint;
+ procedure ZeroMemory(Destination: Pointer; Length: DWORD);
+ function MakeLong(a, b: Word): Longint;
{$ENDIF}
function AdaptFilePaths(const aPath: widestring): widestring;
@@ -71,8 +71,8 @@ function FileExistsInsensitive(var FileName: string): boolean;
// A stable alternative to TList.Sort() (use TList.Sort() if applicable, see below)
procedure MergeSort(List: TList; CompareFunc: TListSortCompare);
-function GetAlignedMem(Size: cardinal; Alignment: integer): pointer;
-procedure FreeAlignedMem(P: pointer);
+function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer;
+procedure FreeAlignedMem(P: Pointer);
implementation
@@ -206,19 +206,20 @@ begin
exOverflow, exUnderflow, exPrecision]);
end;
-function AdaptFilePaths(const aPath: WideString): WideString;
+function AdaptFilePaths( const aPath : widestring ): widestring;
begin
- result := StringReplaceW(aPath, '\', PathDelim);//, [rfReplaceAll]);
+ result := StringReplaceW( aPath, '\', PathDelim );//, [rfReplaceAll] );
end;
{$IFNDEF MSWINDOWS}
-procedure ZeroMemory(Destination: pointer; Length: dword);
+
+procedure ZeroMemory( Destination: Pointer; Length: DWORD );
begin
- FillChar(Destination^, Length, 0);
+ FillChar( Destination^, Length, 0 );
end;
-function MakeLong(A, B: word): longint;
+function MakeLong(A, B: Word): Longint;
begin
Result := (LongInt(B) shl 16) + A;
end;
@@ -243,7 +244,7 @@ begin
Result := false;
FilePath := ExtractFilePath(FileName);
- if (FindFirst(FilePath + '*', faAnyFile, SearchInfo) = 0) then
+ if (FindFirst(FilePath+'*', faAnyFile, SearchInfo) = 0) then
begin
LocalFileName := ExtractFileName(FileName);
repeat
@@ -263,14 +264,14 @@ begin
end;
// +++++++++++++++++++++ helpers for RWOpsFromStream() +++++++++++++++
-function SdlStreamSeek(context: PSDL_RWops; offset: integer; whence: integer): integer; cdecl;
+function SdlStreamSeek( context : PSDL_RWops; offset : Integer; whence : Integer ) : integer; cdecl;
var
- stream: TStream;
- origin: word;
+ stream : TStream;
+ origin : Word;
begin
- stream := TStream(context.unknown);
- if (stream = nil) then
- raise EInvalidContainer.Create('SDLStreamSeek on nil');
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamSeek on nil' );
case whence of
0 : origin := soFromBeginning; // Offset is from the beginning of the resource. Seek moves to the position Offset. Offset must be >= 0.
1 : origin := soFromCurrent; // Offset is from the current position in the resource. Seek moves to Position + Offset.
@@ -278,30 +279,30 @@ begin
else
origin := soFromBeginning; // just in case
end;
- Result := stream.Seek(offset, origin);
+ Result := stream.Seek( offset, origin );
end;
-function SdlStreamRead(context: PSDL_RWops; Ptr: pointer; size: integer; maxnum: integer): integer; cdecl;
+function SdlStreamRead( context : PSDL_RWops; Ptr : Pointer; size : Integer; maxnum: Integer ) : Integer; cdecl;
var
- stream: TStream;
+ stream : TStream;
begin
- stream := TStream(context.unknown);
- if (stream = nil) then
- raise EInvalidContainer.Create('SDLStreamRead on nil');
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamRead on nil' );
try
- Result := stream.read(Ptr^, Size * maxnum) div size;
+ Result := stream.read( Ptr^, Size * maxnum ) div size;
except
Result := -1;
end;
end;
-function SDLStreamClose(context: PSDL_RWops): integer; cdecl;
+function SDLStreamClose( context : PSDL_RWops ) : Integer; cdecl;
var
- stream: TStream;
+ stream : TStream;
begin
- stream := TStream(context.unknown);
- if (stream = nil) then
- raise EInvalidContainer.Create('SDLStreamClose on nil');
+ stream := TStream( context.unknown );
+ if ( stream = nil ) then
+ raise EInvalidContainer.Create( 'SDLStreamClose on nil' );
stream.Free;
Result := 1;
end;
@@ -330,10 +331,12 @@ begin
end;
end;
+
+
{$IFDEF FPC}
-function RandomRange(aMin: integer; aMax: integer): integer;
+function RandomRange(aMin: Integer; aMax: Integer) : Integer;
begin
- RandomRange := Random(aMax - aMin) + aMin ;
+ RandomRange := Random(aMax-aMin) + aMin ;
end;
{$ENDIF}
@@ -386,7 +389,7 @@ begin
System.EnterCriticalSection(ConsoleCriticalSection);
// output pending messages
- for i := 0 to MessageList.Count - 1 do
+ for i := 0 to MessageList.Count-1 do
begin
_ConsoleWriteLn(MessageList[i]);
end;
@@ -459,7 +462,7 @@ end;
procedure ShowMessage(const msg: String; msgType: TMessageType);
{$IFDEF MSWINDOWS}
-var Flags: cardinal;
+var Flags: Cardinal;
{$ENDIF}
begin
{$IF Defined(MSWINDOWS)}
@@ -485,7 +488,7 @@ procedure _MergeSort(InList, TempList, OutList: TList; StartPos, BlockSize: inte
CompareFunc: TListSortCompare);
var
LeftSize, RightSize: integer; // number of elements in left/right block
- LeftEnd, RightEnd: integer; // Index after last element in left/right block
+ LeftEnd, RightEnd: integer; // Index after last element in left/right block
MidPos: integer; // index of first element in right block
Pos: integer; // position in output list
begin
@@ -561,7 +564,7 @@ end;
type
// stores the unaligned pointer of data allocated by GetAlignedMem()
PMemAlignHeader = ^TMemAlignHeader;
- TMemAlignHeader = pointer;
+ TMemAlignHeader = Pointer;
(**
* Use this function to assure that allocated memory is aligned on a specific
@@ -577,9 +580,9 @@ type
* alignments on 16 and 32 byte boundaries too.
*)
{$WARNINGS OFF}
-function GetAlignedMem(Size: cardinal; Alignment: integer): pointer;
+function GetAlignedMem(Size: cardinal; Alignment: integer): Pointer;
var
- OrigPtr: pointer;
+ OrigPtr: Pointer;
const
MIN_ALIGNMENT = 16;
begin
@@ -600,9 +603,9 @@ begin
end;
// reserve space for the header
- Result := pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader));
+ Result := Pointer(PtrUInt(OrigPtr) + SizeOf(TMemAlignHeader));
// align memory
- Result := pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment);
+ Result := Pointer(PtrUInt(Result) + Alignment - PtrUInt(Result) mod Alignment);
// set header with info on old pointer for FreeMem
PMemAlignHeader(PtrUInt(Result) - SizeOf(TMemAlignHeader))^ := OrigPtr;
@@ -610,7 +613,7 @@ end;
{$WARNINGS ON}
{$WARNINGS OFF}
-procedure FreeAlignedMem(P: pointer);
+procedure FreeAlignedMem(P: Pointer);
begin
if (P <> nil) then
FreeMem(PMemAlignHeader(PtrUInt(P) - SizeOf(TMemAlignHeader))^);
diff --git a/unicode/src/base/UConfig.pas b/unicode/src/base/UConfig.pas
index 1214f36f..cb663e2d 100644
--- a/unicode/src/base/UConfig.pas
+++ b/unicode/src/base/UConfig.pas
@@ -107,7 +107,7 @@ const
// include config-file (defines + constants)
{$IF Defined(MSWindows)}
- {$I ..\config-win.inc}
+ {$I ../config-win.inc}
{$ELSEIF Defined(Linux)}
{$I ../config-linux.inc}
{$ELSEIF Defined(FreeBSD)}
diff --git a/unicode/src/base/UDLLManager.pas b/unicode/src/base/UDLLManager.pas
index 3faa15bf..cd4b7991 100644
--- a/unicode/src/base/UDLLManager.pas
+++ b/unicode/src/base/UDLLManager.pas
@@ -40,42 +40,37 @@ uses
type
TDLLMan = class
private
- hLib: THandle;
+ hLib: THandle;
P_Init: fModi_Init;
P_Draw: fModi_Draw;
P_Finish: fModi_Finish;
P_RData: pModi_RData;
public
Plugins: array of TPluginInfo;
- PluginPaths: array of string;
+ PluginPaths: array of String;
Selected: ^TPluginInfo;
constructor Create;
procedure GetPluginList;
- procedure ClearPluginInfo(No: cardinal);
- function LoadPluginInfo(Filename: string; No: cardinal): boolean;
+ procedure ClearPluginInfo(No: Cardinal);
+ function LoadPluginInfo(Filename: String; No: Cardinal): boolean;
- function LoadPlugin(No: cardinal): boolean;
+ function LoadPlugin(No: Cardinal): boolean;
procedure UnLoadPlugin;
- function PluginInit (const TeamInfo: TTeamInfo;
- var Playerinfo: TPlayerinfo;
- const Sentences: TSentences;
- const LoadTex: fModi_LoadTex;
- const Print: fModi_Print;
- LoadSound: fModi_LoadSound;
- PlaySound: pModi_PlaySound)
- : boolean;
- function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean;
+ function PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean;
+ function PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean;
function PluginFinish (var Playerinfo: TPlayerinfo): byte;
- procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: dword; user: dword);
+ procedure PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD);
end;
var
DLLMan: TDLLMan;
const
+ DLLPath = 'Plugins';
+
{$IF Defined(MSWINDOWS)}
DLLExt = '.dll';
{$ELSEIF Defined(DARWIN)}
@@ -92,7 +87,6 @@ uses
{$ELSE}
dynlibs,
{$ENDIF}
- UPath,
ULog,
SysUtils;
@@ -107,33 +101,33 @@ end;
procedure TDLLMan.GetPluginList;
var
- SearchRecord: TSearchRec;
+ SR: TSearchRec;
begin
- if FindFirst(PluginPath + '*' + DLLExt, faAnyFile, SearchRecord) = 0 then
+ if FindFirst(DLLPath +PathDelim+ '*' + DLLExt, faAnyFile , SR) = 0 then
begin
repeat
SetLength(Plugins, Length(Plugins)+1);
SetLength(PluginPaths, Length(Plugins));
- if LoadPluginInfo(SearchRecord.Name, High(Plugins)) then // loaded succesful
+ if LoadPluginInfo(SR.Name, High(Plugins)) then //Loaded succesful
begin
- PluginPaths[High(PluginPaths)] := SearchRecord.Name;
+ PluginPaths[High(PluginPaths)] := SR.Name;
end
- else // error loading
+ else //Error Loading
begin
SetLength(Plugins, Length(Plugins)-1);
SetLength(PluginPaths, Length(Plugins));
end;
- until FindNext(SearchRecord) <> 0;
- FindClose(SearchRecord);
+ until FindNext(SR) <> 0;
+ FindClose(SR);
end;
end;
-procedure TDLLMan.ClearPluginInfo(No: cardinal);
+procedure TDLLMan.ClearPluginInfo(No: Cardinal);
begin
-// set to party modi plugin
+ //Set to Party Modi Plugin
Plugins[No].Typ := 8;
Plugins[No].Name := 'unknown';
@@ -142,117 +136,109 @@ begin
Plugins[No].Creator := 'Nobody';
Plugins[No].PluginDesc := 'NO_PLUGIN_DESC';
- Plugins[No].LoadSong := true;
- Plugins[No].ShowScore := true;
- Plugins[No].ShowBars := true;
- Plugins[No].ShowNotes := true;
- Plugins[No].LoadVideo := true;
- Plugins[No].LoadBack := true;
+ Plugins[No].LoadSong := True;
+ Plugins[No].ShowScore := True;
+ Plugins[No].ShowBars := False;
+ Plugins[No].ShowNotes := True;
+ Plugins[No].LoadVideo := True;
+ Plugins[No].LoadBack := True;
- Plugins[No].TeamModeOnly := true;
- Plugins[No].GetSoundData := true;
- Plugins[No].Dummy := true;
+ Plugins[No].TeamModeOnly := False;
+ Plugins[No].GetSoundData := False;
+ Plugins[No].Dummy := False;
- Plugins[No].BGShowFull := true;
- Plugins[No].BGShowFull_O := true;
+ Plugins[No].BGShowFull := False;
+ Plugins[No].BGShowFull_O := True;
- Plugins[No].ShowRateBar := true;
- Plugins[No].ShowRateBar_O := true;
+ Plugins[No].ShowRateBar:= False;
+ Plugins[No].ShowRateBar_O := True;
- Plugins[No].EnLineBonus := true;
- Plugins[No].EnLineBonus_O := true;
+ Plugins[No].EnLineBonus := False;
+ Plugins[No].EnLineBonus_O := True;
end;
-function TDLLMan.LoadPluginInfo(Filename: string; No: cardinal): boolean;
+function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean;
var
hLibg: THandle;
Info: pModi_PluginInfo;
-// I: integer;
+ //I: Integer;
begin
- Result := true;
-// clear plugin info
+ Result := False;
+ //Clear Plugin Info
ClearPluginInfo(No);
-{
-// workaround plugins loaded 2 times
- for i := low(pluginpaths) to high(pluginpaths) do
- if (pluginpaths[i] = filename) then
- exit;
-}
+ {//Workaround Plugins Loaded 2 Times
+ For I := low(PluginPaths) to high(PluginPaths) do
+ if (PluginPaths[I] = Filename) then
+ exit; }
-// load libary
- hLibg := LoadLibrary(PChar(PluginPath + Filename));
-// if loaded
+ //Load Libary
+ hLibg := LoadLibrary(PChar(DLLPath +PathDelim+ Filename));
+ //If Loaded
if (hLibg <> 0) then
begin
-// load info procedure
- @Info := GetProcAddress(hLibg, PChar('PluginInfo'));
+ //Load Info Procedure
+ @Info := GetProcAddress (hLibg, PChar('PluginInfo'));
-// if loaded
+ //If Loaded
if (@Info <> nil) then
begin
-// load plugininfo
- Info(Plugins[No]);
- Result := true;
+ //Load PluginInfo
+ Info (Plugins[No]);
+ Result := True;
end
else
- Log.LogError('Could not load plugin "' + Filename + '": Info procedure not found');
+ Log.LogError('Could not Load Plugin "' + Filename + '": Info Procedure not Found');
FreeLibrary (hLibg);
end
- else
- Log.LogError('Could not load plugin "' + Filename + '": Libary not loaded');
+ else
+ Log.LogError('Could not Load Plugin "' + Filename + '": Libary not Loaded');
end;
-function TDLLMan.LoadPlugin(No: cardinal): boolean;
+function TDLLMan.LoadPlugin(No: Cardinal): boolean;
begin
- Result := true;
-// load libary
- hLib := LoadLibrary(PChar(PluginPath + PluginPaths[No]));
-// if loaded
+ Result := False;
+ //Load Libary
+ hLib := LoadLibrary(PChar(DLLPath +PathDelim+ PluginPaths[No]));
+ //If Loaded
if (hLib <> 0) then
begin
-// load info procedure
- @P_Init := GetProcAddress (hLib, 'Init');
- @P_Draw := GetProcAddress (hLib, 'Draw');
- @P_Finish := GetProcAddress (hLib, 'Finish');
+ //Load Info Procedure
+ @P_Init := GetProcAddress (hLib, PChar('Init'));
+ @P_Draw := GetProcAddress (hLib, PChar('Draw'));
+ @P_Finish := GetProcAddress (hLib, PChar('Finish'));
-// if loaded
- if (@P_Init <> nil) and (@P_Draw <> nil) and (@P_Finish <> nil) then
+ //If Loaded
+ if (@P_Init <> nil) And (@P_Draw <> nil) And (@P_Finish <> nil) then
begin
Selected := @Plugins[No];
- Result := true;
+ Result := True;
end
else
begin
- Log.LogError('Could not load plugin "' + PluginPaths[No] + '": Procedures not found');
+ Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Procedures not Found');
+
end;
end
- else
- Log.LogError('Could not load plugin "' + PluginPaths[No] + '": Libary not loaded');
+ else
+ Log.LogError('Could not Load Plugin "' + PluginPaths[No] + '": Libary not Loaded');
end;
procedure TDLLMan.UnLoadPlugin;
begin
- if (hLib <> 0) then
- FreeLibrary (hLib);
-
-// Selected := nil;
- @P_Init := nil;
- @P_Draw := nil;
- @P_Finish := nil;
- @P_RData := nil;
+if (hLib <> 0) then
+ FreeLibrary (hLib);
+
+//Selected := nil;
+@P_Init := nil;
+@P_Draw := nil;
+@P_Finish := nil;
+@P_RData := nil;
end;
-function TDLLMan.PluginInit (const TeamInfo: TTeamInfo;
- var Playerinfo: TPlayerinfo;
- const Sentences: TSentences;
- const LoadTex: fModi_LoadTex;
- const Print: fModi_Print;
- LoadSound: fModi_LoadSound;
- PlaySound: pModi_PlaySound)
- : boolean;
+function TDLLMan.PluginInit (const TeamInfo: TTeamInfo; var Playerinfo: TPlayerinfo; const Sentences: TSentences; const LoadTex: fModi_LoadTex; const Print: fModi_Print; LoadSound: fModi_LoadSound; PlaySound: pModi_PlaySound): boolean;
var
Methods: TMethodRec;
begin
@@ -264,26 +250,26 @@ begin
if (@P_Init <> nil) then
Result := P_Init (TeamInfo, PlayerInfo, Sentences, Methods)
else
- Result := true
+ Result := False
end;
-function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: cardinal): boolean;
+function TDLLMan.PluginDraw (var Playerinfo: TPlayerinfo; const CurSentence: Cardinal): boolean;
begin
- if (@P_Draw <> nil) then
- Result := P_Draw (PlayerInfo, CurSentence)
- else
- Result := true
+if (@P_Draw <> nil) then
+ Result := P_Draw (PlayerInfo, CurSentence)
+else
+ Result := False
end;
function TDLLMan.PluginFinish (var Playerinfo: TPlayerinfo): byte;
begin
- if (@P_Finish <> nil) then
- Result := P_Finish (PlayerInfo)
- else
- Result := 0;
+if (@P_Finish <> nil) then
+ Result := P_Finish (PlayerInfo)
+else
+ Result := 0;
end;
-procedure TDLLMan.PluginRData (handle: HStream; buffer: Pointer; len: dword; user: dword);
+procedure TDLLMan.PluginRData (handle: HSTREAM; buffer: Pointer; len: DWORD; user: DWORD);
begin
if (@P_RData <> nil) then
P_RData (handle, buffer, len, user);
diff --git a/unicode/src/base/UDraw.pas b/unicode/src/base/UDraw.pas
index 1783986f..8a66d271 100644
--- a/unicode/src/base/UDraw.pas
+++ b/unicode/src/base/UDraw.pas
@@ -638,7 +638,7 @@ begin
// determine lyric help bar position and size
Bounds.Left := MoveStartX + BarProgress * MoveDist;
Bounds.Right := Bounds.Left + BarWidth;
- Bounds.Top := Theme.LyricBar.IndicatorYOffset + Theme.LyricBar.UpperY ;
+ Bounds.Top := Skin_LyricsT + 3;
Bounds.Bottom := Bounds.Top + BarHeight + 3;
// draw lyric help bar
diff --git a/unicode/src/base/UEditorLyrics.pas b/unicode/src/base/UEditorLyrics.pas
index ef9d8dd6..fe8c3ee5 100644
--- a/unicode/src/base/UEditorLyrics.pas
+++ b/unicode/src/base/UEditorLyrics.pas
@@ -40,7 +40,7 @@ uses
UTexture;
type
- TAlignmentType = (atLeft, atCenter, atRight);
+ alignment = (left, center, right);
TWord = record
X: real;
@@ -58,7 +58,7 @@ type
TEditorLyrics = class
private
- AlignI: TAlignmentType;
+ AlignI: alignment;
XR: real;
YR: real;
SizeR: real;
@@ -69,7 +69,7 @@ type
procedure SetX(Value: real);
procedure SetY(Value: real);
function GetClientX: real;
- procedure SetAlign(Value: TAlignmentType);
+ procedure SetAlign(Value: alignment);
function GetSize: real;
procedure SetSize(Value: real);
procedure SetSelected(Value: integer);
@@ -96,7 +96,7 @@ type
property X: real write SetX;
property Y: real write SetY;
property ClientX: real read GetClientX;
- property Align: TAlignmentType write SetAlign;
+ property Align: alignment write SetAlign;
property Size: real read GetSize write SetSize;
property Selected: integer read SelectedI write SetSelected;
property FontStyle: integer write SetFontStyle;
@@ -137,7 +137,7 @@ begin
Result := Word[0].X;
end;
-procedure TEditorLyrics.SetAlign(Value: TAlignmentType);
+procedure TEditorLyrics.SetAlign(Value: alignment);
begin
AlignI := Value;
end;
@@ -229,7 +229,7 @@ var
WordIndex: integer;
TotalWidth: real;
begin
- if AlignI = atCenter then
+ if AlignI = center then
begin
TotalWidth := 0;
for WordIndex := 0 to High(Word) do
diff --git a/unicode/src/base/UGraphic.pas b/unicode/src/base/UGraphic.pas
index 818e49aa..17175d02 100644
--- a/unicode/src/base/UGraphic.pas
+++ b/unicode/src/base/UGraphic.pas
@@ -198,14 +198,7 @@ var
Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture;
Tex_Score_Ratings : array [0..7] of TTexture;
-
- // arrows for SelectSlide
- Tex_SelectS_ArrowL: TTexture;
- Tex_SelectS_ArrowR: TTexture;
-
- // textures for software mouse cursor
- Tex_Cursor_Unpressed: TTexture;
- Tex_Cursor_Pressed: TTexture;
+
const
Skin_BGColorR = 1;
Skin_BGColorG = 1;
@@ -239,6 +232,17 @@ const
Skin_OscG = 0;
Skin_OscB = 0;
+ // TODO: add to theme ini file
+ Skin_LyricsT = 493;
+ Skin_LyricsUpperX = 80;
+ Skin_LyricsUpperW = 640;
+ Skin_LyricsUpperY = Skin_LyricsT;
+ Skin_LyricsUpperH = 41;
+ Skin_LyricsLowerX = 80;
+ Skin_LyricsLowerW = 640;
+ Skin_LyricsLowerY = Skin_LyricsT + Skin_LyricsUpperH + 1;
+ Skin_LyricsLowerH = 41;
+
Skin_SpectrumT = 470;
Skin_SpectrumBot = 570;
Skin_SpectrumH = 100;
@@ -335,15 +339,6 @@ begin
Tex_Ball := Texture.LoadTexture(Skin.GetTextureFileName('Ball'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
Tex_Lyric_Help_Bar := Texture.LoadTexture(Skin.GetTextureFileName('LyricHelpBar'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
- Tex_SelectS_ArrowL := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowLeft'), TEXTURE_TYPE_TRANSPARENT, 0);
- Tex_SelectS_ArrowR := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowRight'), TEXTURE_TYPE_TRANSPARENT, 0);
-
- Tex_Cursor_Unpressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor'), TEXTURE_TYPE_TRANSPARENT, 0);
-
- if (Skin.GetTextureFileName('Cursor_Pressed') <> '') then
- Tex_Cursor_Pressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor_Pressed'), TEXTURE_TYPE_TRANSPARENT, 0)
- else
- Tex_Cursor_Pressed.TexNum := 0;
//TimeBar mod
Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar'));
@@ -502,7 +497,6 @@ begin
Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D');
Display := TDisplay.Create;
- //Display.SetCursor;
//Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2);
@@ -635,15 +629,15 @@ begin
begin
Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen');
screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN );
+ SDL_ShowCursor(0);
end
else
begin
Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed');
screen := SDL_SetVideoMode(W, H, 0, SDL_OPENGL or SDL_RESIZABLE);
+ SDL_ShowCursor(1);
end;
- SDL_ShowCursor(0);
-
if (screen = nil) then
begin
Log.LogCritical('SDL_SetVideoMode Failed', 'Initialize3D');
diff --git a/unicode/src/base/UImage.pas b/unicode/src/base/UImage.pas
index 60b0a3a2..8dc38495 100644
--- a/unicode/src/base/UImage.pas
+++ b/unicode/src/base/UImage.pas
@@ -311,13 +311,13 @@ var
hour, minute, second, msecond: word;
begin
DecodeDate(time, year, month, day);
- pngTime.year := png_uint_16(year);
- pngTime.month := png_byte(month);
- pngTime.day := png_byte(day);
+ pngTime.year := year;
+ pngTime.month := month;
+ pngTime.day := day;
DecodeTime(time, hour, minute, second, msecond);
- pngTime.hour := png_byte(hour);
- pngTime.minute := png_byte(minute);
- pngTime.second := png_byte(second);
+ pngTime.hour := hour;
+ pngTime.minute := minute;
+ pngTime.second := second;
end;
(*
@@ -896,13 +896,8 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
// replaced by division of longwords, shifted by 10 bits to keep
// digits.
- // The use of longwards leeds to some type size mismatch warnings
- // whenever differences are formed.
- // This should not be a problem, since the results should all be positive.
- // replacing longword by longint would probably resolve this cosmetic fault :-)
-
function ColorToHue(const Color: longword): longword;
- // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024
+ // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024
var
Red, Green, Blue: longword;
Min, Max, Delta: longword;
@@ -924,8 +919,7 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
if Blue > Max then Max := Blue;
// calc hue
- Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0
- // But the assignments above are easy enough to be sure, that Max - Min is >= 0.
+ Delta := Max - Min;
if (Delta = 0) then
Result := 0
else
@@ -1029,19 +1023,16 @@ begin
end
else // all colors except black and white
begin
- Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0
- // But the assignments above are easy enough to be sure, that Max - Min is >= 0.
+ Delta := Max - Min;
Sat := (Delta shl 10) div Max; // shl 10
- // shr 10 corrects that Sat and f are shl 10
+ // shr 10 corrects that sat and f are shl 10
// the resulting p, q and t are unshifted
p := (Max*(1024-Sat)) shr 10;
q := (Max*(1024-(Sat*f) shr 10)) shr 10;
t := (Max*(1024-(Sat*(1024-f)) shr 10)) shr 10;
- // The above 3 lines give type size mismatch warning, but all variables are longword and the ranges should be ok.
-
case HueInteger of
0: begin Red := Max; Green := t; Blue := p; end; // (v,t,p)
1: begin Red := q; Green := Max; Blue := p; end; // (q,v,p)
@@ -1052,13 +1043,13 @@ begin
end;
{$IFDEF FPC_BIG_ENDIAN}
- PixelColors[3] := byte(Red);
- PixelColors[2] := byte(Green);
- PixelColors[1] := byte(Blue);
+ PixelColors[3] := Red;
+ PixelColors[2] := Green;
+ PixelColors[1] := Blue
{$ELSE}
- PixelColors[0] := byte(Red);
- PixelColors[1] := byte(Green);
- PixelColors[2] := byte(Blue);
+ PixelColors[0] := Red;
+ PixelColors[1] := Green;
+ PixelColors[2] := Blue;
{$ENDIF}
end;
diff --git a/unicode/src/base/UIni.pas b/unicode/src/base/UIni.pas
index 61c39d32..241b34e8 100644
--- a/unicode/src/base/UIni.pas
+++ b/unicode/src/base/UIni.pas
@@ -78,7 +78,6 @@ type
function ReadArrayIndex(const SearchArray: array of string; IniFile: TCustomIniFile;
IniSection: string; IniProperty: string; Default: integer): integer;
- procedure TranslateOptionValues;
procedure LoadInputDeviceCfg(IniFile: TMemIniFile);
procedure SaveInputDeviceCfg(IniFile: TIniFile);
procedure LoadThemes(IniFile: TCustomIniFile);
@@ -156,7 +155,6 @@ type
// Controller
Joypad: integer;
- Mouse: integer;
// default encoding for texts (lyrics, song-name, ...)
EncodingDefault: TEncoding;
@@ -200,13 +198,14 @@ const
IBackgroundMusic: array[0..1] of string = ('Off', 'On');
- ITextureSize: array[0..3] of string = ('64', '128', '256', '512');
- ITextureSizeVals: array[0..3] of integer = ( 64, 128, 256, 512);
+ ITextureSize: array[0..2] of string = ('128', '256', '512');
+ ITextureSizeVals: array[0..2] of integer = ( 128, 256, 512);
ISingWindow: array[0..1] of string = ('Small', 'Big');
//SingBar Mod
- IOscilloscope: array[0..1] of string = ('Off', 'On');
+ IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar');
+//IOscilloscope: array[0..1] of string = ('Off', 'On');
ISpectrum: array[0..1] of string = ('Off', 'On');
ISpectrograph: array[0..1] of string = ('Off', 'On');
@@ -247,75 +246,15 @@ const
IScreenFade: array[0..1] of string = ('Off', 'On');
IAskbeforeDel: array[0..1] of string = ('Off', 'On');
IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu');
- ILineBonus: array[0..1] of string = ('Off', 'On');
+ ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes');
IPartyPopup: array[0..1] of string = ('Off', 'On');
IJoypad: array[0..1] of string = ('Off', 'On');
- IMouse: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor');
// Recording options
IChannelPlayer: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6');
IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB');
-var
- IDifficultyTranslated: array[0..2] of string = ('Easy', 'Medium', 'Hard');
- ITabsTranslated: array[0..1] of string = ('Off', 'On');
-
- ISortingTranslated: array[0..7] of string = ('Edition', 'Genre', 'Language', 'Folder', 'Title', 'Artist', 'Title2', 'Artist2');
-
- IDebugTranslated: array[0..1] of string = ('Off', 'On');
-
- IFullScreenTranslated: array[0..1] of string = ('Off', 'On');
- IVisualizerTranslated: array[0..2] of string = ('Off', 'WhenNoVideo','On');
-
- IBackgroundMusicTranslated: array[0..1] of string = ('Off', 'On');
- ISingWindowTranslated: array[0..1] of string = ('Small', 'Big');
-
- //SingBar Mod
- IOscilloscopeTranslated: array[0..1] of string = ('Off', 'On');
-
- ISpectrumTranslated: array[0..1] of string = ('Off', 'On');
- ISpectrographTranslated: array[0..1] of string = ('Off', 'On');
- IMovieSizeTranslated: array[0..2] of string = ('Half', 'Full [Vid]', 'Full [BG+Vid]');
-
- IClickAssistTranslated: array[0..1] of string = ('Off', 'On');
- IBeatClickTranslated: array[0..1] of string = ('Off', 'On');
- ISavePlaybackTranslated: array[0..1] of string = ('Off', 'On');
-
- IVoicePassthroughTranslated: array[0..1] of string = ('Off', 'On');
-
- //Song Preview
- IPreviewVolumeTranslated: array[0..10] of string = ('Off', '10%', '20%', '30%', '40%', '50%', '60%', '70%', '80%', '90%', '100%');
-
- IAudioOutputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536');
-
- IAudioInputBufferSizeTranslated: array[0..9] of string = ('Auto', '256', '512', '1024', '2048', '4096', '8192', '16384', '32768', '65536');
-
- IPreviewFadingTranslated: array[0..5] of string = ('Off', '1 Sec', '2 Secs', '3 Secs', '4 Secs', '5 Secs');
-
- ILyricsFontTranslated: array[0..2] of string = ('Plain', 'OLine1', 'OLine2');
- ILyricsEffectTranslated: array[0..4] of string = ('Simple', 'Zoom', 'Slide', 'Ball', 'Shift');
- ISolmizationTranslated: array[0..3] of string = ('Off', 'Euro', 'Jap', 'American');
- INoteLinesTranslated: array[0..1] of string = ('Off', 'On');
-
- IColorTranslated: array[0..8] of string = ('Blue', 'Green', 'Pink', 'Red', 'Violet', 'Orange', 'Yellow', 'Brown', 'Black');
-
- // Advanced
- ILoadAnimationTranslated: array[0..1] of string = ('Off', 'On');
- IEffectSingTranslated: array[0..1] of string = ('Off', 'On');
- IScreenFadeTranslated: array[0..1] of string = ('Off', 'On');
- IAskbeforeDelTranslated: array[0..1] of string = ('Off', 'On');
- IOnSongClickTranslated: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu');
- ILineBonusTranslated: array[0..1] of string = ('Off', 'On');
- IPartyPopupTranslated: array[0..1] of string = ('Off', 'On');
-
- IJoypadTranslated: array[0..1] of string = ('Off', 'On');
- IMouseTranslated: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor');
-
- // Recording options
- IChannelPlayerTranslated: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6');
- IMicBoostTranslated: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB');
-
implementation
uses
@@ -331,188 +270,6 @@ uses
UUnicodeUtils;
(**
- * Translate and set the values of options, which need translation.
- *)
-procedure TIni.TranslateOptionValues;
-begin
- ULanguage.Language.ChangeLanguage(ILanguage[Language]);
-
- IDifficultyTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EASY');
- IDifficultyTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_MEDIUM');
- IDifficultyTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_HARD');
-
- ITabsTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ITabsTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ISortingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_EDITION');
- ISortingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GENRE');
- ISortingTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_LANGUAGE');
- ISortingTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_FOLDER');
- ISortingTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_TITLE');
- ISortingTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST');
- ISortingTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_TITLE2');
- ISortingTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_ARTIST2');
-
- IDebugTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IDebugTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IFullScreenTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IFullScreenTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IVisualizerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IVisualizerTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_WHENNOVIDEO');
- IVisualizerTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IBackgroundMusicTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IBackgroundMusicTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ISingWindowTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SMALL');
- ISingWindowTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_BIG');
-
- IOscilloscopeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IOscilloscopeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ISpectrumTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ISpectrumTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ISpectrographTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ISpectrographTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IMovieSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_HALF');
- IMovieSizeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID');
- IMovieSizeTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_FULL_VID_BG');
-
- IClickAssistTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IClickAssistTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IBeatClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IBeatClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ISavePlaybackTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ISavePlaybackTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IVoicePassthroughTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IVoicePassthroughTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- ILyricsFontTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_PLAIN');
- ILyricsFontTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_OLINE1');
- ILyricsFontTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OLINE2');
-
- ILyricsEffectTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SIMPLE');
- ILyricsEffectTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ZOOM');
- ILyricsEffectTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SLIDE');
- ILyricsEffectTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_BALL');
- ILyricsEffectTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_SHIFT');
-
- ISolmizationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ISolmizationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_EURO');
- ISolmizationTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_JAPAN');
- ISolmizationTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_AMERICAN');
-
- INoteLinesTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- INoteLinesTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IColorTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_BLUE');
- IColorTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_GREEN');
- IColorTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_PINK');
- IColorTranslated[3] := ULanguage.Language.Translate('OPTION_VALUE_RED');
- IColorTranslated[4] := ULanguage.Language.Translate('OPTION_VALUE_VIOLET');
- IColorTranslated[5] := ULanguage.Language.Translate('OPTION_VALUE_ORANGE');
- IColorTranslated[6] := ULanguage.Language.Translate('OPTION_VALUE_YELLOW');
- IColorTranslated[7] := ULanguage.Language.Translate('OPTION_VALUE_BROWN');
- IColorTranslated[8] := ULanguage.Language.Translate('OPTION_VALUE_BALCK');
-
- // Advanced
- ILoadAnimationTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ILoadAnimationTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IEffectSingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IEffectSingTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IScreenFadeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IScreenFadeTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IAskbeforeDelTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IAskbeforeDelTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IOnSongClickTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_SING');
- IOnSongClickTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_SELECT_PLAYERS');
- IOnSongClickTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_OPEN_MENU');
-
- ILineBonusTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- ILineBonusTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IPartyPopupTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IPartyPopupTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IJoypadTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IJoypadTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_ON');
-
- IMouseTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IMouseTranslated[1] := ULanguage.Language.Translate('OPTION_VALUE_HARDWARE_CURSOR');
- IMouseTranslated[2] := ULanguage.Language.Translate('OPTION_VALUE_SOFTWARE_CURSOR');
-
- IAudioOutputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO');
- IAudioOutputBufferSizeTranslated[1] := '256';
- IAudioOutputBufferSizeTranslated[2] := '512';
- IAudioOutputBufferSizeTranslated[3] := '1024';
- IAudioOutputBufferSizeTranslated[4] := '2048';
- IAudioOutputBufferSizeTranslated[5] := '4096';
- IAudioOutputBufferSizeTranslated[6] := '8192';
- IAudioOutputBufferSizeTranslated[7] := '16384';
- IAudioOutputBufferSizeTranslated[8] := '32768';
- IAudioOutputBufferSizeTranslated[9] := '65536';
-
-
- IAudioInputBufferSizeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_AUTO');
- IAudioInputBufferSizeTranslated[1] := '256';
- IAudioInputBufferSizeTranslated[2] := '512';
- IAudioInputBufferSizeTranslated[3] := '1024';
- IAudioInputBufferSizeTranslated[4] := '2048';
- IAudioInputBufferSizeTranslated[5] := '4096';
- IAudioInputBufferSizeTranslated[6] := '8192';
- IAudioInputBufferSizeTranslated[7] := '16384';
- IAudioInputBufferSizeTranslated[8] := '32768';
- IAudioInputBufferSizeTranslated[9] := '65536';
-
- //Song Preview
- IPreviewVolumeTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IPreviewVolumeTranslated[1] := '10%';
- IPreviewVolumeTranslated[2] := '20%';
- IPreviewVolumeTranslated[3] := '30%';
- IPreviewVolumeTranslated[4] := '40%';
- IPreviewVolumeTranslated[5] := '50%';
- IPreviewVolumeTranslated[6] := '60%';
- IPreviewVolumeTranslated[7] := '70%';
- IPreviewVolumeTranslated[8] := '80%';
- IPreviewVolumeTranslated[9] := '90%';
- IPreviewVolumeTranslated[10] := '100%';
-
-
- IPreviewFadingTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IPreviewFadingTranslated[1] := '1 ' + ULanguage.Language.Translate('OPTION_VALUE_SEC');
- IPreviewFadingTranslated[2] := '2 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS');
- IPreviewFadingTranslated[3] := '3 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS');
- IPreviewFadingTranslated[4] := '4 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS');
- IPreviewFadingTranslated[5] := '5 ' + ULanguage.Language.Translate('OPTION_VALUE_SECS');
-
- // Recording options
- IChannelPlayerTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IChannelPlayerTranslated[1] := '1';
- IChannelPlayerTranslated[2] := '2';
- IChannelPlayerTranslated[3] := '3';
- IChannelPlayerTranslated[4] := '4';
- IChannelPlayerTranslated[5] := '5';
- IChannelPlayerTranslated[6] := '6';
-
- IMicBoostTranslated[0] := ULanguage.Language.Translate('OPTION_VALUE_OFF');
- IMicBoostTranslated[1] := '+6dB';
- IMicBoostTranslated[2] := '+12dB';
- IMicBoostTranslated[3] := '+18dB';
-
-end;
-
-(**
* Returns the filename without its fileextension
*)
function TIni.RemoveFileExt(FullName: string): string;
@@ -836,7 +593,6 @@ begin
end;
// reverse order
- Log.LogStatus( 'Log size of resolution: ' + IntToStr(Length(IResolution)), 'Video');
for I := 0 to (Length(IResolution) div 2) - 1 do
begin
swap(IResolution[I], IResolution[High(IResolution)-I]);
@@ -930,7 +686,7 @@ begin
SingWindow := GetArrayIndex(ISingWindow, IniFile.ReadString('Graphics', 'SingWindow', 'Big'));
// Oscilloscope
- Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', IOscilloscope[0]));
+ Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'));
// Spectrum
Spectrum := GetArrayIndex(ISpectrum, IniFile.ReadString('Graphics', 'Spectrum', 'Off'));
@@ -957,16 +713,16 @@ begin
PreviewVolume := GetArrayIndex(IPreviewVolume, IniFile.ReadString('Sound', 'PreviewVolume', IPreviewVolume[7]));
//Preview Fading
- PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[3]));
+ PreviewFading := GetArrayIndex(IPreviewFading, IniFile.ReadString('Sound', 'PreviewFading', IPreviewFading[1]));
//AudioRepeat aka VoicePassthrough
VoicePassthrough := GetArrayIndex(IVoicePassthrough, IniFile.ReadString('Sound', 'VoicePassthrough', IVoicePassthrough[0]));
// Lyrics Font
- LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[0]));
+ LyricsFont := GetArrayIndex(ILyricsFont, IniFile.ReadString('Lyrics', 'LyricsFont', ILyricsFont[1]));
// Lyrics Effect
- LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[2]));
+ LyricsEffect := GetArrayIndex(ILyricsEffect, IniFile.ReadString('Lyrics', 'LyricsEffect', ILyricsEffect[1]));
// Solmization
Solmization := GetArrayIndex(ISolmization, IniFile.ReadString('Lyrics', 'Solmization', ISolmization[0]));
@@ -1014,7 +770,7 @@ begin
OnSongClick := GetArrayIndex(IOnSongClick, IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'));
// Linebonus
- LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', ILineBonus[1]));
+ LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', 'At Score'));
// PartyPopup
PartyPopup := GetArrayIndex(IPartyPopup, IniFile.ReadString('Advanced', 'PartyPopup', 'On'));
@@ -1022,13 +778,8 @@ begin
// Joypad
Joypad := GetArrayIndex(IJoypad, IniFile.ReadString('Controller', 'Joypad', IJoypad[0]));
- // Mouse
- Mouse := GetArrayIndex(IMouse, IniFile.ReadString('Controller', 'Mouse', IMouse[2]));
-
LoadPaths(IniFile);
- TranslateOptionValues;
-
IniFile.Free;
end;
@@ -1169,9 +920,6 @@ begin
// Joypad
IniFile.WriteString('Controller', 'Joypad', IJoypad[Joypad]);
- // Mouse
- IniFile.WriteString('Controller', 'Mouse', IMouse[Mouse]);
-
// Directories (add a template if section is missing)
// Note: Value must be ' ' and not '', otherwise no key is generated on Linux
if (not IniFile.SectionExists('Directories')) then
diff --git a/unicode/src/base/UMain.pas b/unicode/src/base/UMain.pas
index 1962e953..8d11b91d 100644
--- a/unicode/src/base/UMain.pas
+++ b/unicode/src/base/UMain.pas
@@ -66,6 +66,11 @@ implementation
uses
Math,
gl,
+{
+ SDL_ttf,
+ UParty,
+ UCore,
+}
UCatCovers,
UCommandLine,
UCommon,
@@ -83,12 +88,10 @@ uses
UPath,
UPlaylist,
UMusic,
- UBeatTimer,
UPlatform,
USkins,
USongs,
UThemes,
- UParty,
UTime;
procedure Main;
@@ -233,12 +236,14 @@ begin
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading PluginManager', 1);
+{
// Party Mode Manager
Log.BenchmarkStart(1);
Log.LogStatus('PartySession Manager', 'Initialization');
PartySession := TPartySession.Create; //Load PartySession
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading PartySession Manager', 1);
+}
// Graphics
Log.BenchmarkStart(1);
@@ -359,11 +364,9 @@ begin
CountMidTime;
Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid);
- Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay));
if Delay >= 1 then
SDL_Delay(Delay); // dynamic, maximum is 100 fps
- Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay));
CountSkipTime;
@@ -377,26 +380,9 @@ begin
end;
end;
-procedure DoQuit;
-begin
- // if question option is enabled then show exit popup
- if (Ini.AskbeforeDel = 1) then
- begin
- Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX');
- end
- else // if ask-for-exit is disabled then simply exit
- begin
- Display.Fade := 0;
- Display.NextScreenWithCheck := nil;
- Display.CheckOK := true;
- end;
-end;
-
procedure CheckEvents;
var
- Event: TSDL_event;
- mouseDown: boolean;
- mouseBtn: integer;
+ Event: TSDL_event;
begin
if Assigned(Display.NextScreen) then
Exit;
@@ -410,46 +396,17 @@ begin
Display.NextScreenWithCheck := nil;
Display.CheckOK := true;
end;
-
- SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP:
+ SDL_MOUSEBUTTONDOWN:
begin
- if (Ini.Mouse > 0) then
+{
+ with Event.button do
begin
- case Event.type_ of
- SDL_MOUSEMOTION:
- begin
- mouseDown := false;
- mouseBtn := 0;
- end;
- SDL_MOUSEBUTTONDOWN:
- begin
- mouseDown := true;
- mouseBtn := Event.button.button;
- end;
- SDL_MOUSEBUTTONUP:
- begin
- mouseDown := false;
- mouseBtn := Event.button.button;
- end;
- end;
-
- Display.MoveCursor(Event.button.X * 800 / Screen.w,
- Event.button.Y * 600 / Screen.h,
- mouseDown and ((mouseBtn <> SDL_BUTTON_WHEELDOWN) or (mouseBtn <> SDL_BUTTON_WHEELUP)));
-
- if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then
- done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y)
- else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then
- done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y)
- else
+ if State = SDL_BUTTON_LEFT then
begin
- done := not Display.CurrentScreen^.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y);
-
- // if screen wants to exit
- if done then
- DoQuit;
+ //
end;
end;
+}
end;
SDL_VIDEORESIZE:
begin
@@ -485,14 +442,14 @@ begin
if boolean( Ini.FullScreen ) then
begin
SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN);
+ SDL_ShowCursor(0);
end
else
begin
SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE);
+ SDL_ShowCursor(1);
end;
- Display.SetCursor;
-
glViewPort(0, 0, ScreenW, ScreenH);
{$IFEND}
end
@@ -512,7 +469,19 @@ begin
// if screen wants to exit
if Done then
- DoQuit;
+ begin
+ // if question option is enabled then show exit popup
+ if (Ini.AskbeforeDel = 1) then
+ begin
+ Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX');
+ end
+ else // if ask-for-exit is disabled then simply exit
+ begin
+ Display.Fade := 0;
+ Display.NextScreenWithCheck := nil;
+ Display.CheckOK := true;
+ end;
+ end;
end;
end;
diff --git a/unicode/src/base/UMusic.pas b/unicode/src/base/UMusic.pas
index 5fc9805f..19c3b942 100644
--- a/unicode/src/base/UMusic.pas
+++ b/unicode/src/base/UMusic.pas
@@ -36,8 +36,7 @@ interface
uses
UTime,
SysUtils,
- Classes,
- UBeatTimer;
+ Classes;
type
TNoteType = (ntFreestyle, ntNormal, ntGolden);
@@ -100,6 +99,51 @@ type
Line: array of TLine;
end;
+ (**
+ * TLyricsState contains all information concerning the
+ * state of the lyrics, e.g. the current beat or duration of the lyrics.
+ *)
+ TLyricsState = class
+ private
+ Timer: TRelativeTimer; // keeps track of the current time
+ public
+ OldBeat: integer; // previous discovered beat
+ CurrentBeat: integer; // current beat (rounded)
+ MidBeat: real; // current beat (float)
+
+ // now we use this for super synchronization!
+ // only used when analyzing voice
+ // TODO: change ...D to ...Detect(ed)
+ OldBeatD: integer; // previous discovered beat
+ CurrentBeatD: integer; // current discovered beat (rounded)
+ MidBeatD: real; // current discovered beat (float)
+
+ // we use this for audible clicks
+ // TODO: Change ...C to ...Click
+ OldBeatC: integer; // previous discovered beat
+ CurrentBeatC: integer;
+ MidBeatC: real; // like CurrentBeatC
+
+ OldLine: integer; // previous displayed sentence
+
+ StartTime: real; // time till start of lyrics (= Gap)
+ TotalTime: real; // total song time
+
+ constructor Create();
+ procedure Pause();
+ procedure Resume();
+
+ procedure Reset();
+ procedure UpdateBeats();
+
+ (**
+ * current song time (in seconds) used as base-timer for lyrics etc.
+ *)
+ function GetCurrentTime(): real;
+ procedure SetCurrentTime(Time: real);
+ end;
+
+
const
FFTSize = 512; // size of FFT data (output: FFTSize/2 values)
type
@@ -933,6 +977,92 @@ begin
end;
end;
+
+{ TVoiceRemoval }
+
+constructor TLyricsState.Create();
+begin
+ // create a triggered timer, so we can Pause() it, set the time
+ // and Resume() it afterwards for better synching.
+ Timer := TRelativeTimer.Create(true);
+
+ // reset state
+ Reset();
+end;
+
+procedure TLyricsState.Pause();
+begin
+ Timer.Pause();
+end;
+
+procedure TLyricsState.Resume();
+begin
+ Timer.Resume();
+end;
+
+procedure TLyricsState.SetCurrentTime(Time: real);
+begin
+ // do not start the timer (if not started already),
+ // after setting the current time
+ Timer.SetTime(Time, false);
+end;
+
+function TLyricsState.GetCurrentTime(): real;
+begin
+ Result := Timer.GetTime();
+end;
+
+(**
+ * Resets the timer and state of the lyrics.
+ * The timer will be stopped afterwards so you have to call Resume()
+ * to start the lyrics timer.
+ *)
+procedure TLyricsState.Reset();
+begin
+ Pause();
+ SetCurrentTime(0);
+
+ StartTime := 0;
+ TotalTime := 0;
+
+ OldBeat := -1;
+ MidBeat := -1;
+ CurrentBeat := -1;
+
+ OldBeatC := -1;
+ MidBeatC := -1;
+ CurrentBeatC := -1;
+
+ OldBeatD := -1;
+ MidBeatD := -1;
+ CurrentBeatD := -1;
+end;
+
+(**
+ * Updates the beat information (CurrentBeat/MidBeat/...) according to the
+ * current lyric time.
+ *)
+procedure TLyricsState.UpdateBeats();
+var
+ CurLyricsTime: real;
+begin
+ CurLyricsTime := GetCurrentTime();
+
+ OldBeat := CurrentBeat;
+ MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000);
+ CurrentBeat := Floor(MidBeat);
+
+ OldBeatC := CurrentBeatC;
+ MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000);
+ CurrentBeatC := Floor(MidBeatC);
+
+ OldBeatD := CurrentBeatD;
+ // MidBeatD = MidBeat with additional GAP
+ MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000);
+ CurrentBeatD := Floor(MidBeatD);
+end;
+
+
{ TAudioConverter }
function TAudioConverter.Init(SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): boolean;
diff --git a/unicode/src/base/UNote.pas b/unicode/src/base/UNote.pas
index 6da4cf07..5e70bfe1 100644
--- a/unicode/src/base/UNote.pas
+++ b/unicode/src/base/UNote.pas
@@ -126,10 +126,12 @@ uses
UDLLManager,
UParty,
UConfig,
+ UCore,
UCommon,
UGraphic,
UGraphicClasses,
UPath,
+ UPluginDefs,
UPlatform,
UThemes;
diff --git a/unicode/src/base/UParty.pas b/unicode/src/base/UParty.pas
index b02d13be..937aab78 100644
--- a/unicode/src/base/UParty.pas
+++ b/unicode/src/base/UParty.pas
@@ -34,85 +34,208 @@ interface
{$I switches.inc}
uses
- ModiSDK;
+ UPartyDefs,
+ UCoreModule,
+ UPluginDefs;
type
+ ARounds = array [0..252] of integer; //0..252 needed for
+ PARounds = ^ARounds;
+
TRoundInfo = record
- Plugin: word;
+ Modi: cardinal;
Winner: byte;
end;
TeamOrderEntry = record
- TeamNum: byte;
- Score: byte;
+ Teamnum: byte;
+ Score: byte;
end;
TeamOrderArray = array[0..5] of byte;
- TPartyPlugin = record
- ID: byte;
- TimesPlayed: byte;
+ TUS_ModiInfoEx = record
+ Info: TUS_ModiInfo;
+ Owner: integer;
+ TimesPlayed: byte; //Helper for setting round plugins
end;
- TPartySession = class
+ TPartySession = class (TCoreModule)
private
- function GetRandomPlayer(Team: byte): byte;
- function GetRandomPlugin(Plugins: array of TPartyPlugin): byte;
- function IsWinner(Player, Winner: byte): boolean;
- procedure GenScores;
- public
- Teams: TTeamInfo;
- Rounds: array of TRoundInfo;
+ bPartyMode: boolean; //Is this party or single player
CurRound: byte;
- constructor Create;
+ Modis: array of TUS_ModiInfoEx;
+ Teams: TTeamInfo;
- procedure StartNewParty(NumRounds: byte);
- procedure StartRound;
- procedure EndRound;
- function GetTeamOrder: TeamOrderArray;
- function GetWinnerString(Round: byte): string;
+ function IsWinner(Player, Winner: byte): boolean;
+ procedure GenScores;
+ function GetRandomPlugin(TeamMode: boolean): cardinal;
+ function GetRandomPlayer(Team: byte): byte;
+ public
+ //Teams: TTeamInfo;
+ Rounds: array of TRoundInfo;
+
+ //TCoreModule methods to inherit
+ constructor Create; override;
+ procedure Info(const pInfo: PModuleInfo); override;
+ function Load: boolean; override;
+ function Init: boolean; override;
+ procedure DeInit; override;
+ destructor Destroy; override;
+
+ //Register modus service
+ function RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer; //Registers a new modus. wParam: Pointer to TUS_ModiInfo
+
+ //Start new Party
+ function StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer; //Starts new party mode. Returns non zero on success
+ function GetCurModi(wParam: TwParam; lParam: TlParam): integer; //Returns pointer to cur. Modis TUS_ModiInfo (to Use with Singscreen)
+ function StopParty(wParam: TwParam; lParam: TlParam): integer; //Stops party mode. Returns 1 if party mode was enabled before.
+ function NextRound(wParam: TwParam; lParam: TlParam): integer; //Increases curround by 1; Returns num of round or -1 if last round is already played
+
+ function CallModiInit(wParam: TwParam; lParam: TlParam): integer; //Calls curmodis init proc. If an error occurs, returns nonzero. In this case a new plugin was selected. Please renew loading
+ function CallModiDeInit(wParam: TwParam; lParam: TlParam): integer; //Calls DeInitProc and ends the round
+
+ function GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Writes TTeamInfo record to pointer at lParam. Returns zero on success
+ function SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer; //Read TTeamInfo record from pointer at lParam. Returns zero on success
+
+ function GetTeamOrder(wParam: TwParam; lParam: TlParam): integer; //Returns team order. Structure: Bits 1..3: Team at place1; Bits 4..6: Team at place2 ...
+ function GetWinnerString(wParam: TwParam; lParam: TlParam): integer; //wParam is roundnum. If (Pointer = nil) then return length of the string. Otherwise write the string to address at lParam
end;
-var
- PartySession: TPartySession;
+const
+ StandardModus = 0; //Modus ID that will be played in non-party mode
implementation
uses
- UDLLManager,
+ UCore,
UGraphic,
- UNote,
ULanguage,
- ULog;
+ ULog,
+ UNote,
+ SysUtils;
+{*********************
+ TPluginLoader
+ Implentation
+*********************}
+
+//-------------
+// function that gives some infos about the module to the core
+//-------------
+procedure TPartySession.Info(const pInfo: PModuleInfo);
+begin
+ pInfo^.Name := 'TPartySession';
+ pInfo^.Version := MakeVersion(1,0,0,chr(0));
+ pInfo^.Description := 'Manages party modi and party game';
+end;
+
+//-------------
+// Just the constructor
+//-------------
constructor TPartySession.Create;
begin
inherited;
+ //UnSet PartyMode
+ bPartyMode := false;
+end;
+
+//-------------
+//Is called on loading.
+//In this method only events and services should be created
+//to offer them to other modules or plugins during the init process
+//If false is returned this will cause a forced exit
+//-------------
+function TPartySession.Load: boolean;
+begin
+ //Add register party modus service
+ Result := true;
+ Core.Services.AddService('Party/RegisterModi', nil, Self.RegisterModi);
+ Core.Services.AddService('Party/StartParty', nil, Self.StartParty);
+ Core.Services.AddService('Party/GetCurModi', nil, Self.GetCurModi);
+end;
+
+//-------------
+//Is called on init process
+//In this method you can hook some events and create + init
+//your classes, variables etc.
+//If false is returned this will cause a forced exit
+//-------------
+function TPartySession.Init: boolean;
+begin
+ //Just set private var to true.
+ Result := true;
+end;
+
+//-------------
+//Is called if this module has been inited and there is an exit.
+//Deinit is in reverse initing order
+//-------------
+procedure TPartySession.DeInit;
+begin
+ //Force DeInit
+end;
+
+//-------------
+//Is called if this module will be unloaded and has been created
+//Should be used to free memory
+//-------------
+destructor TPartySession.Destroy;
+begin
+ //Just save some memory if it wasn't done now..
+ SetLength(Modis, 0);
+ inherited;
+end;
+
+//-------------
+// Registers a new modus. wParam: Pointer to TUS_ModiInfo
+// Service for plugins
+//-------------
+function TPartySession.RegisterModi(nothin: TwParam; pModiInfo: TlParam): integer;
+var
+ Len: integer;
+ Info: PUS_ModiInfo;
+begin
+ Info := PModiInfo;
+ //Copy Info if cbSize is correct
+ if (Info.cbSize = SizeOf(TUS_ModiInfo)) then
+ begin
+ Len := Length(Modis);
+ SetLength(Modis, Len + 1);
+
+ Modis[Len].Info := Info^;
+ end
+ else
+ Core.ReportError(integer(PChar('Plugins try to register modus with wrong pointer, or wrong TUS_ModiInfo record.')), PChar('TPartySession'));
+
+ // FIXME: return a valid result
+ Result := 0;
end;
//----------
// Returns a number of a random plugin
//----------
-function TPartySession.GetRandomPlugin(Plugins: array of TPartyPlugin): byte;
+function TPartySession.GetRandomPlugin(TeamMode: boolean): cardinal;
var
- LowestTP: byte;
+ LowestTP: byte;
NumPwithLTP: word;
- I: integer;
- R: word;
+ I: integer;
+ R: word;
begin
+ Result := StandardModus; //If there are no matching modi, play standard modus
LowestTP := high(byte);
NumPwithLTP := 0;
//Search for Plugins not often played yet
- for I := 0 to high(Plugins) do
+ for I := 0 to high(Modis) do
begin
- if (Plugins[I].TimesPlayed < lowestTP) then
+ if (Modis[I].TimesPlayed < lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
begin
- lowestTP := Plugins[I].TimesPlayed;
+ lowestTP := Modis[I].TimesPlayed;
NumPwithLTP := 1;
end
- else if (Plugins[I].TimesPlayed = lowestTP) then
+ else if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
begin
Inc(NumPwithLTP);
end;
@@ -122,97 +245,118 @@ begin
R := Random(NumPwithLTP);
//Search for random plugin
- for I := 0 to high(Plugins) do
+ for I := 0 to high(Modis) do
begin
- if Plugins[I].TimesPlayed = LowestTP then
+ if (Modis[I].TimesPlayed = lowestTP) and (((Modis[I].Info.LoadingSettings and MLS_TeamOnly) <> 0) = TeamMode) then
begin
//Plugin found
if (R = 0) then
begin
- Result := Plugins[I].ID;
- Inc(Plugins[I].TimesPlayed);
+ Result := I;
+ Inc(Modis[I].TimesPlayed);
Break;
end;
+
Dec(R);
end;
end;
end;
//----------
-//StartNewParty - Reset and prepares for new party
+// Starts new party mode. Returns non zero on success
//----------
-procedure TPartySession.StartNewParty(NumRounds: byte);
+function TPartySession.StartParty(NumRounds: TwParam; PAofIRounds: TlParam): integer;
var
- Plugins: array of TPartyPlugin;
+ I: integer;
+ aiRounds: PARounds;
TeamMode: boolean;
- Len: integer;
- I, J: integer;
begin
- //Set current round to 1
- CurRound := 255;
+ Result := 0;
+ if (Teams.NumTeams >= 1) and (NumRounds < High(byte)-1) then
+ begin
+ bPartyMode := false;
+ aiRounds := PAofIRounds;
+
+ try
+ //Is this team mode (More than one player per team) ?
+ TeamMode := true;
+ for I := 0 to Teams.NumTeams-1 do
+ TeamMode := TeamMode and (Teams.Teaminfo[I].NumPlayers > 1);
+
+ //Set Rounds
+ SetLength(Rounds, NumRounds);
+
+ for I := 0 to High(Rounds) do
+ begin //Set plugins
+ if (aiRounds[I] = -1) then
+ Rounds[I].Modi := GetRandomPlugin(TeamMode)
+ else if (aiRounds[I] >= 0) and (aiRounds[I] <= High(Modis)) and (TeamMode or ((Modis[aiRounds[I]].Info.LoadingSettings and MLS_TeamOnly) = 0)) then
+ Rounds[I].Modi := aiRounds[I]
+ else
+ Rounds[I].Modi := StandardModus;
+
+ Rounds[I].Winner := High(byte); //Set winner to not played
+ end;
- PlayersPlay := Teams.NumTeams;
+ CurRound := High(byte); //Set CurRound to not defined
- //Get team-mode and set joker, also set TimesPlayed
- TeamMode := true;
- for I := 0 to Teams.NumTeams - 1 do
- begin
- if Teams.Teaminfo[I].NumPlayers < 2 then
- begin
- TeamMode := false;
- end;
- //Set player attributes
- for J := 0 to Teams.TeamInfo[I].NumPlayers-1 do
- begin
- Teams.TeamInfo[I].Playerinfo[J].TimesPlayed := 0;
+ //Return true and set party mode
+ bPartyMode := true;
+ Result := 1;
+
+ except
+ Core.ReportError(integer(PChar('Can''t start party mode.')), PChar('TPartySession'));
end;
- Teams.Teaminfo[I].Joker := Round(NumRounds * 0.7);
- Teams.Teaminfo[I].Score := 0;
end;
+end;
- //Fill plugin array
- SetLength(Plugins, 0);
- for I := 0 to high(DLLMan.Plugins) do
- begin
- if TeamMode or (not DLLMan.Plugins[I].TeamModeOnly) then
- begin
- //Add only those plugins playable with current PlayerConfiguration
- Len := Length(Plugins);
- SetLength(Plugins, Len + 1);
- Plugins[Len].ID := I;
- Plugins[Len].TimesPlayed := 0;
- end;
+//----------
+// Returns pointer to Cur. ModiInfoEx (to use with sing screen)
+//----------
+function TPartySession.GetCurModi(wParam: TwParam; lParam: TlParam): integer;
+begin
+ if (bPartyMode) and (CurRound <= High(Rounds)) then
+ begin //If PartyMode is enabled:
+ //Return the Plugin of the Cur Round
+ Result := integer(@Modis[Rounds[CurRound].Modi]);
+ end
+ else
+ begin //Return standard modus
+ Result := integer(@Modis[StandardModus]);
end;
+end;
- //Set rounds
- if (Length(Plugins) >= 1) then
+//----------
+// Stops party mode. Returns 1 if party mode was enabled before and -1 if change was not possible
+//----------
+function TPartySession.StopParty(wParam: TwParam; lParam: TlParam): integer;
+begin
+ Result := -1;
+ if (bPartyMode) then
begin
- SetLength (Rounds, NumRounds);
- for I := 0 to NumRounds - 1 do
- begin
- PartySession.Rounds[I].Plugin := GetRandomPlugin(Plugins);
- PartySession.Rounds[I].Winner := 255;
- end;
+ // to-do : Whitü: Check here if sing screen is not shown atm.
+ bPartyMode := false;
+ Result := 1;
end
else
- SetLength (Rounds, 0);
+ Result := 0;
end;
-{**
- * Returns a random player to play next round
- *}
+//----------
+//GetRandomPlayer - gives back a random player to play next round
+//----------
function TPartySession.GetRandomPlayer(Team: byte): byte;
var
- I, R: integer;
- LowestTP: byte;
+ I, R: integer;
+ lowestTP: byte;
NumPwithLTP: byte;
begin
- LowestTP := high(byte);
+ LowestTP := high(byte);
NumPwithLTP := 0;
- Result := 0;
+ Result := 0;
//Search for players that have not often played yet
- for I := 0 to Teams.Teaminfo[Team].NumPlayers - 1 do
+ for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do
begin
if (Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed < lowestTP) then
begin
@@ -225,11 +369,11 @@ begin
end;
end;
- //Create random number
+ //Create random no
R := Random(NumPwithLTP);
//Search for random player
- for I := 0 to Teams.Teaminfo[Team].NumPlayers - 1 do
+ for I := 0 to Teams.Teaminfo[Team].NumPlayers-1 do
begin
if Teams.Teaminfo[Team].Playerinfo[I].TimesPlayed = lowestTP then
begin
@@ -245,93 +389,212 @@ begin
end;
end;
-{**
- * Prepares ScreenSingModi for next round and loads plugin
- *}
-procedure TPartySession.StartRound;
+//----------
+// NextRound - Increases CurRound by 1; Returns num of round or -1 if last round is already played
+//----------
+function TPartySession.NextRound(wParam: TwParam; lParam: TlParam): integer;
var
I: integer;
begin
if ((CurRound < high(Rounds)) or (CurRound = high(CurRound))) then
- begin
- //Increase Current Round
+ begin //everythings OK! -> Start the Round, maaaaan
Inc(CurRound);
- Rounds[CurRound].Winner := 255;
- DllMan.LoadPlugin(Rounds[CurRound].Plugin);
-
- //Select Players
- for I := 0 to Teams.NumTeams - 1 do
+ //Set Players to play this Round
+ for I := 0 to Teams.NumTeams-1 do
Teams.Teaminfo[I].CurPlayer := GetRandomPlayer(I);
+
+ // FIXME: return a valid result
+ Result := 0;
+ end
+ else
+ Result := -1;
+end;
+
+//----------
+//IsWinner - returns true if the players bit is set in the winner byte
+//----------
+function TPartySession.IsWinner(Player, Winner: byte): boolean;
+var
+ Bit: byte;
+begin
+ Bit := 1 shl Player;
+
+ Result := ((Winner and Bit) = Bit);
+end;
+
+//----------
+//GenScores - inc scores for cur. round
+//----------
+procedure TPartySession.GenScores;
+var
+ I: byte;
+begin
+ for I := 0 to Teams.NumTeams-1 do
+ begin
+ if isWinner(I, Rounds[CurRound].Winner) then
+ Inc(Teams.Teaminfo[I].Score);
+ end;
+end;
+
+//----------
+// CallModiInit - calls CurModis Init Proc. If an error occurs, returns nonzero. In this case a new plugin was selected. Please renew loading
+//----------
+function TPartySession.CallModiInit(wParam: TwParam; lParam: TlParam): integer;
+begin
+ if (not bPartyMode) then
+ begin //Set rounds if not in party mode
+ SetLength(Rounds, 1);
+ Rounds[0].Modi := StandardModus;
+ Rounds[0].Winner := High(byte);
+ CurRound := 0;
+ end;
- //Set ScreenSingModie Variables
- ScreenSingModi.TeamInfo := Teams;
+ try
+ //Core.
+ except
+ on E : Exception do
+ begin
+ Core.ReportError(integer(PChar('Error starting modus: ' + Modis[Rounds[CurRound].Modi].Info.Name + ' ErrorStr: ' + E.Message)), PChar('TPartySession'));
+ if (Rounds[CurRound].Modi = StandardModus) then
+ begin
+ Core.ReportError(integer(PChar('Can''t start standard modus, will exit now!')), PChar('TPartySession'));
+ Halt;
+ end
+ else //Select standard modus
+ begin
+ Rounds[CurRound].Modi := StandardModus
+ end;
+ end;
end;
+
+ // FIXME: return a valid result
+ Result := 0;
end;
//----------
-//EndRound - Get Winner from ScreenSingModi and Save Data to RoundArray
+// CallModiDeInit - calls DeInitProc and ends the round
//----------
-procedure TPartySession.EndRound;
+function TPartySession.CallModiDeInit(wParam: TwParam; lParam: TlParam): integer;
var
- I: Integer;
+ I: integer;
+ MaxScore: word;
begin
- //Copy Winner
- Rounds[CurRound].Winner := ScreenSingModi.Winner;
- //Set Scores
- GenScores;
+ if (bPartyMode) then
+ begin
+ //Get Winner Byte!
+ if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then //get winners from plugin
+ Rounds[CurRound].Winner := Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID)
+ else
+ begin //Create winners by score :/
+ Rounds[CurRound].Winner := 0;
+ MaxScore := 0;
+ for I := 0 to Teams.NumTeams-1 do
+ begin
+ // to-do : recode percentage stuff
+ //PlayerInfo.Playerinfo[I].Percentage := PlayerInfo.Playerinfo[I].Score div 9999;
+ if (Player[I].ScoreTotalInt > MaxScore) then
+ begin
+ MaxScore := Player[I].ScoreTotalInt;
+ Rounds[CurRound].Winner := 1 shl I;
+ end
+ else if (Player[I].ScoreTotalInt = MaxScore) and (Player[I].ScoreTotalInt <> 0) then
+ begin
+ Rounds[CurRound].Winner := Rounds[CurRound].Winner or (1 shl I);
+ end;
+ end;
+
+
+ //When nobody has points -> everybody looses
+ if (MaxScore = 0) then
+ Rounds[CurRound].Winner := 0;
+
+ end;
- //Increase TimesPlayed 4 all Players
- For I := 0 to Teams.NumTeams-1 do
- Inc(Teams.Teaminfo[I].Playerinfo[Teams.Teaminfo[I].CurPlayer].TimesPlayed);
+ //Generate the scores
+ GenScores;
+ //Inc players TimesPlayed
+ if ((Modis[Rounds[CurRound-1].Modi].Info.LoadingSettings and MLS_IncTP) = MLS_IncTP) then
+ begin
+ for I := 0 to Teams.NumTeams-1 do
+ Inc(Teams.TeamInfo[I].Playerinfo[Teams.TeamInfo[I].CurPlayer].TimesPlayed);
+ end;
+ end
+ else if (@Modis[Rounds[CurRound].Modi].Info.ModiDeInit <> nil) then
+ Modis[Rounds[CurRound].Modi].Info.ModiDeInit(Modis[Rounds[CurRound].Modi].Info.ID);
+
+ // FIXME: return a valid result
+ Result := 0;
end;
//----------
-//IsWinner - returns true if the player's bit is set in the winner byte
+// GetTeamInfo - writes TTeamInfo record to pointer at lParam. Returns zero on success
//----------
-function TPartySession.IsWinner(Player, Winner: byte): boolean;
+function TPartySession.GetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer;
var
- Mask: byte;
+ Info: ^TTeamInfo;
begin
- Mask := 1 shl Player;
- Result := (Winner and Mask) <> 0;
+ Result := -1;
+ Info := pTeamInfo;
+ if (Info <> nil) then
+ begin
+ try
+ // to - do : Check Delphi memory management in this case
+ //Not sure if i had to copy PChars to a new address or if delphi manages this o0
+ Info^ := Teams;
+ Result := 0;
+ except
+ Result := -2;
+ end;
+ end;
end;
//----------
-//GenScores - increase scores for current round
+// SetTeamInfo - read TTeamInfo record from pointer at lParam. Returns zero on success
//----------
-procedure TPartySession.GenScores;
+function TPartySession.SetTeamInfo(wParam: TwParam; pTeamInfo: TlParam): integer;
var
- I: byte;
+ TeamInfobackup: TTeamInfo;
+ Info: ^TTeamInfo;
begin
- for I := 0 to Teams.NumTeams - 1 do
+ Result := -1;
+ Info := pTeamInfo;
+ if (Info <> nil) then
begin
- if isWinner(I, Rounds[CurRound].Winner) then
- Inc(Teams.Teaminfo[I].Score);
+ try
+ TeamInfoBackup := Teams;
+ // to - do : Check Delphi memory management in this case
+ //Not sure if i had to copy PChars to a new address or if delphi manages this o0
+ Teams := Info^;
+ Result := 0;
+ except
+ Teams := TeamInfoBackup;
+ Result := -2;
+ end;
end;
end;
//----------
-//GetTeamOrder - returns the placement of each Team [First Position of Array is Teamnum of first placed Team, ...]
+// GetTeamOrder - returns team order. Structure: Bits 1..3: Team at place1; Bits 4..6: Team at place2 ...
//----------
-function TPartySession.GetTeamOrder: TeamOrderArray;
+function TPartySession.GetTeamOrder(wParam: TwParam; lParam: TlParam): integer;
var
- I, J: integer;
- ATeams: array [0..5] of TeamOrderEntry;
+ I, J: integer;
+ ATeams: array [0..5] of TeamOrderEntry;
TempTeam: TeamOrderEntry;
begin
- // TODO: PartyMode: Write this in another way, so that teams with the same score get the same place
+ // to-do : PartyMode: Write this in another way, so that teams with the same score get the same place
//Fill Team array
- for I := 0 to Teams.NumTeams - 1 do
+ for I := 0 to Teams.NumTeams-1 do
begin
ATeams[I].Teamnum := I;
ATeams[I].Score := Teams.Teaminfo[I].Score;
end;
//Sort teams
- for J := 0 to Teams.NumTeams - 1 do
- for I := 1 to Teams.NumTeams - 1 do
+ for J := 0 to Teams.NumTeams-1 do
+ for I := 1 to Teams.NumTeams-1 do
if ATeams[I].Score > ATeams[I-1].Score then
begin
TempTeam := ATeams[I-1];
@@ -340,44 +603,63 @@ begin
end;
//Copy to Result
+ Result := 0;
for I := 0 to Teams.NumTeams-1 do
- Result[I] := ATeams[I].TeamNum;
+ Result := Result or (ATeams[I].TeamNum Shl I*3);
end;
//----------
-//GetWinnerString - Get string with WinnerTeam Name, when there is more than one Winner than Connect with and or ,
+// GetWinnerString - wParam is Roundnum. If (pointer = nil) then return length of the string. Otherwise write the string to address at lParam
//----------
-function TPartySession.GetWinnerString(Round: byte): string;
+function TPartySession.GetWinnerString(wParam: TwParam; lParam: TlParam): integer;
var
Winners: array of UTF8String;
- I: integer;
+ I: integer;
+ ResultStr: String;
+ S: ^String;
begin
- Result := Language.Translate('PARTY_NOBODY');
-
- if (Round > High(Rounds)) then
- exit;
+ ResultStr := Language.Translate('PARTY_NOBODY');
- if (Rounds[Round].Winner = 0) then
+ if (wParam <= High(Rounds)) then
begin
- exit;
+ if (Rounds[wParam].Winner <> 0) then
+ begin
+ if (Rounds[wParam].Winner = 255) then
+ begin
+ ResultStr := Language.Translate('PARTY_NOTPLAYEDYET');
+ end
+ else
+ begin
+ SetLength(Winners, 0);
+ for I := 0 to Teams.NumTeams-1 do
+ begin
+ if isWinner(I, Rounds[wParam].Winner) then
+ begin
+ SetLength(Winners, Length(Winners) + 1);
+ Winners[high(Winners)] := Teams.TeamInfo[I].Name;
+ end;
+ end;
+ ResultStr := Language.Implode(Winners);
+ end;
+ end;
end;
- if (Rounds[Round].Winner = 255) then
- begin
- Result := Language.Translate('PARTY_NOTPLAYEDYET');
- exit;
- end;
+ //Now return what we have got
+ if (lParam = nil) then
+ begin //Return string length
+ Result := Length(ResultStr);
+ end
+ else
+ begin //Return string
+ try
+ S := lParam;
+ S^ := ResultStr;
+ Result := 0;
+ except
+ Result := -1;
- SetLength(Winners, 0);
- for I := 0 to Teams.NumTeams - 1 do
- begin
- if isWinner(I, Rounds[Round].Winner) then
- begin
- SetLength(Winners, Length(Winners) + 1);
- Winners[high(Winners)] := Teams.TeamInfo[I].Name;
end;
end;
- Result := Language.Implode(Winners);
end;
end.
diff --git a/unicode/src/base/UPlatform.pas b/unicode/src/base/UPlatform.pas
index 6f13481c..e4cb6f0c 100644
--- a/unicode/src/base/UPlatform.pas
+++ b/unicode/src/base/UPlatform.pas
@@ -43,9 +43,9 @@ uses
type
TDirectoryEntry = record
- Name: WideString;
- IsDirectory: boolean;
- IsFile: boolean;
+ Name : WideString;
+ IsDirectory : boolean;
+ IsFile : boolean;
end;
TDirectoryEntryArray = array of TDirectoryEntry;
@@ -54,12 +54,12 @@ type
function GetExecutionDir(): string;
procedure Init; virtual;
function DirectoryFindFiles(Dir, Filter: WideString; ReturnAllSubDirs: boolean): TDirectoryEntryArray; virtual; abstract;
- function TerminateIfAlreadyRunning(var WndTitle: string): boolean; virtual;
+ function TerminateIfAlreadyRunning(var WndTitle : string): boolean; virtual;
function FindSongFile(Dir, Mask: WideString): WideString; virtual;
procedure Halt; virtual;
- function GetLogPath: WideString; virtual; abstract;
- function GetGameSharedPath: WideString; virtual; abstract;
- function GetGameUserPath: WideString; virtual; abstract;
+ function GetLogPath : WideString; virtual; abstract;
+ function GetGameSharedPath : WideString; virtual; abstract;
+ function GetGameUserPath : WideString; virtual; abstract;
function CopyFile(const Source, Target: WideString; FailIfExists: boolean): boolean; virtual;
end;
@@ -79,13 +79,13 @@ uses
ULog;
-// I modified it to use the Platform_singleton in this location (in the implementation)
+// I have modified it to use the Platform_singleton in this location ( in the implementaiton )
// so that this variable can NOT be overwritten from anywhere else in the application.
// the accessor function platform, emulates all previous calls to work the same way.
var
- Platform_singleton: TPlatform;
+ Platform_singleton : TPlatform;
-function Platform: TPlatform;
+function Platform : TPlatform;
begin
Result := Platform_singleton;
end;
@@ -117,7 +117,7 @@ end;
(**
* Default TerminateIfAlreadyRunning() implementation
*)
-function TPlatform.TerminateIfAlreadyRunning(var WndTitle: string): boolean;
+function TPlatform.TerminateIfAlreadyRunning(var WndTitle : string): Boolean;
begin
Result := false;
end;
@@ -143,7 +143,7 @@ const
var
SourceFile, TargetFile: TFileStream;
FileCopyBuffer: array [0..COPY_BUFFER_SIZE-1] of byte; // temporary copy-buffer.
- NumberOfBytes: integer; // number of bytes read from SourceFile
+ NumberOfBytes: integer; // number of bytes read from SourceFile
begin
Result := false;
SourceFile := nil;
diff --git a/unicode/src/base/URecord.pas b/unicode/src/base/URecord.pas
index 2c2093a0..8f37262d 100644
--- a/unicode/src/base/URecord.pas
+++ b/unicode/src/base/URecord.pas
@@ -54,7 +54,7 @@ type
function GetToneString: string; // converts a tone to its string represenatation;
- procedure BoostBuffer(Buffer: PByteArray; Size: integer);
+ procedure BoostBuffer(Buffer: PByteArray; Size: cardinal);
procedure ProcessNewBuffer(Buffer: PByteArray; BufferSize: integer);
// we call it to analyze sound by checking Autocorrelation
@@ -135,7 +135,7 @@ type
procedure UpdateInputDeviceConfig;
// handle microphone input
- procedure HandleMicrophoneData(Buffer: PByteArray; Size: integer;
+ procedure HandleMicrophoneData(Buffer: PByteArray; Size: cardinal;
InputDevice: TAudioInputDevice);
end;
@@ -459,7 +459,7 @@ begin
Result := '-';
end;
-procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: integer);
+procedure TCaptureBuffer.BoostBuffer(Buffer: PByteArray; Size: cardinal);
var
i: integer;
Value: longint;
@@ -602,7 +602,7 @@ end;
* Length - number of bytes in Buffer
* Input - Soundcard-Input used for capture
*}
-procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: PByteArray; Size: integer; InputDevice: TAudioInputDevice);
+procedure TAudioInputProcessor.HandleMicrophoneData(Buffer: PByteArray; Size: cardinal; InputDevice: TAudioInputDevice);
var
MultiChannelBuffer: PByteArray; // buffer handled as array of bytes (offset relative to channel)
SingleChannelBuffer: PByteArray; // temporary buffer for new samples per channel
@@ -611,11 +611,13 @@ var
CaptureChannel: TCaptureBuffer;
AudioFormat: TAudioFormatInfo;
SampleSize: integer;
+ SampleCount: integer;
SamplesPerChannel: integer;
i: integer;
begin
AudioFormat := InputDevice.AudioFormat;
SampleSize := AudioSampleSize[AudioFormat.Format];
+ SampleCount := Size div SampleSize;
SamplesPerChannel := Size div AudioFormat.FrameSize;
SingleChannelBufferSize := SamplesPerChannel * SampleSize;
diff --git a/unicode/src/base/USingScores.pas b/unicode/src/base/USingScores.pas
index c998644b..2d9b1e5e 100644
--- a/unicode/src/base/USingScores.pas
+++ b/unicode/src/base/USingScores.pas
@@ -34,211 +34,211 @@ interface
{$I switches.inc}
uses
- gl,
UThemes,
+ gl,
UTexture;
//////////////////////////////////////////////////////////////
// ATTENTION: //
-// Enabled flag does not work atm. This should cause popups //
-// not to move and scores to stay until re-enabling. //
-// To use e.g. in pause mode //
-// also invisible flag causes attributes not to change. //
-// This should be fixed after next draw when visible = true,//
-// but not tested yet //
+// Enabled Flag does not Work atm. This should cause Popups //
+// Not to Move and Scores to stay until Renenabling. //
+// To use e.g. in Pause Mode //
+// Also InVisible Flag causes Attributes not to change. //
+// This should be fixed after next Draw when Visible = True,//
+// but not testet yet //
//////////////////////////////////////////////////////////////
-// some constants containing options that could change by time
+//Some constants containing options that could change by time
const
- MaxPlayers = 6; // maximum of players that could be added
- MaxPositions = 6; // maximum of score positions that could be added
+ MaxPlayers = 6; //Maximum of Players that could be added
+ MaxPositions = 6; //Maximum of Score Positions that could be added
type
//-----------
- // TScorePlayer - record containing information about a players score
+ // TScorePlayer - Record Containing Information about a Players Score
//-----------
TScorePlayer = record
- Position: byte; // index of the position where the player should be drawn
- Enabled: boolean; // is the score display enabled
- Visible: boolean; // is the score display visible
- Score: word; // current score of the player
- ScoreDisplayed: word; // score cur. displayed (for counting up)
- ScoreBG: TTexture; // texture of the players scores bg
- Color: TRGB; // the players color
- RBPos: real; // cur. percentille of the rating bar
- RBTarget: real; // target position of rating bar
- RBVisible: boolean; // is rating bar drawn
+ Position: Byte; //Index of the Position where the Player should be Drawn
+ Enabled: Boolean; //Is the Score Display Enabled
+ Visible: Boolean; //Is the Score Display Visible
+ Score: Word; //Current Score of the Player
+ ScoreDisplayed: Word; //Score cur. Displayed(for counting up)
+ ScoreBG: TTexture;//Texture of the Players Scores BG
+ Color: TRGB; //Teh Players Color
+ RBPos: Real; //Cur. Percentille of the Rating Bar
+ RBTarget: Real; //Target Position of Rating Bar
+ RBVisible:Boolean; //Is Rating bar Drawn
end;
- aScorePlayer = array [0..MaxPlayers-1] of TScorePlayer;
+ aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer;
//-----------
- // TScorePosition - record containing information about a score position, that can be used
+ // TScorePosition - Record Containing Information about a Score Position, that can be used
//-----------
PScorePosition = ^TScorePosition;
TScorePosition = record
- // the position is used for which playercount
- PlayerCount: byte;
- // 1 - 1 player per screen
- // 2 - 2 players per screen
- // 4 - 3 players per screen
- // 6 would be 2 and 3 players per screen
-
- BGX: real; // x position of the score bg
- BGY: real; // y position of the score bg
- BGW: real; // width of the score bg
- BGH: real; // height of the score bg
-
- RBX: real; // x position of the rating bar
- RBY: real; // y position of the rating bar
- RBW: real; // width of the rating bar
- RBH: real; // height of the rating bar
-
- TextX: real; // x position of the score text
- TextY: real; // y position of the score text
- TextFont: byte; // font of the score text
- TextSize: integer; // size of the score text
-
- PUW: real; // width of the line bonus popup
- PUH: real; // height of the line bonus popup
- PUFont: byte; // font for the popups
- PUFontSize: integer; // font size for the popups
- PUStartX: real; // x start position of the line bonus popup
- PUStartY: real; // y start position of the line bonus popup
- PUTargetX: real; // x target position of the line bonus popup
- PUTargetY: real; // y target position of the line bonus popup
+ //The Position is Used for Which Playercount
+ PlayerCount: Byte;
+ // 1 - One Player per Screen
+ // 2 - 2 Players per Screen
+ // 4 - 3 Players per Screen
+ // 6 would be 2 and 3 Players per Screen
+
+ BGX: Real; //X Position of the Score BG
+ BGY: Real; //Y Position of the Score BG
+ BGW: Real; //Width of the Score BG
+ BGH: Real; //Height of the Score BG
+
+ RBX: Real; //X Position of the Rating Bar
+ RBY: Real; //Y Position of the Rating Bar
+ RBW: Real; //Width of the Rating Bar
+ RBH: Real; //Height of the Rating Bar
+
+ TextX: Real; //X Position of the Score Text
+ TextY: Real; //Y Position of the Score Text
+ TextFont: Byte; //Font of the Score Text
+ TextSize: integer; //Size of the Score Text
+
+ PUW: Real; //Width of the LineBonus Popup
+ PUH: Real; //Height of the LineBonus Popup
+ PUFont: Byte; //Font for the PopUps
+ PUFontSize: integer; //FontSize for the PopUps
+ PUStartX: Real; //X Start Position of the LineBonus Popup
+ PUStartY: Real; //Y Start Position of the LineBonus Popup
+ PUTargetX: Real; //X Target Position of the LineBonus Popup
+ PUTargetY: Real; //Y Target Position of the LineBonus Popup
end;
- aScorePosition = array [0..MaxPositions-1] of TScorePosition;
+ aScorePosition = array[0..MaxPositions-1] of TScorePosition;
//-----------
- // TScorePopUp - record containing information about a line bonus popup
- // list, next item is saved in next attribute
+ // TScorePopUp - Record Containing Information about a LineBonus Popup
+ // List, Next Item is Saved in Next attribute
//-----------
PScorePopUp = ^TScorePopUp;
TScorePopUp = record
- Player: byte; // index of the popups player
- TimeStamp: cardinal; // timestamp of popups spawn
- Rating: byte; // 0 to 8, type of rating (cool, bad, etc.)
- ScoreGiven: word; // score that has already been given to the player
- ScoreDiff: word; // difference between cur score at spawn and old score
- Next: PScorePopUp; // next item in list
+ Player: Byte; //Index of the PopUps Player
+ TimeStamp: Cardinal; //Timestamp of Popups Spawn
+ Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.)
+ ScoreGiven:Word; //Score that has already been given to the Player
+ ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score
+ Next: PScorePopUp; //Next Item in List
end;
aScorePopUp = array of TScorePopUp;
//-----------
- // TSingScores - class containing scores positions and drawing scores, rating bar + popups
+ // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups
//-----------
TSingScores = class
private
Positions: aScorePosition;
- aPlayers: aScorePlayer;
- oPositionCount: byte;
- oPlayerCount: byte;
+ aPlayers: aScorePlayer;
+ oPositionCount: Byte;
+ oPlayerCount: Byte;
- // saves the first and last popup of the list
+ //Saves the First and Last Popup of the List
FirstPopUp: PScorePopUp;
LastPopUp: PScorePopUp;
- // draws a popup by pointer
+ // Draws a Popup by Pointer
procedure DrawPopUp(const PopUp: PScorePopUp);
- // draws a score by playerindex
- procedure DrawScore(const Index: integer);
+ // Draws a Score by Playerindex
+ procedure DrawScore(const Index: Integer);
- // draws the rating bar by playerindex
- procedure DrawRatingBar(const Index: integer);
+ // Draws the RatingBar by Playerindex
+ procedure DrawRatingBar(const Index: Integer);
- // removes a popup w/o destroying the list
+ // Removes a PopUp w/o destroying the List
procedure KillPopUp(const last, cur: PScorePopUp);
public
- Settings: record // Record containing some Displaying Options
- Phase1Time: real; // time for phase 1 to complete (in msecs)
- // the plop up of the popup
- Phase2Time: real; // time for phase 2 to complete (in msecs)
- // the moving (mainly upwards) of the popup
- Phase3Time: real; // time for phase 3 to complete (in msecs)
- // the fade out and score adding
+ Settings: record //Record containing some Displaying Options
+ Phase1Time: Real; //time for Phase 1 to complete (in msecs)
+ //The Plop Up of the PopUp
+ Phase2Time: Real; //time for Phase 2 to complete (in msecs)
+ //The Moving (mainly Upwards) of the Popup
+ Phase3Time: Real; //time for Phase 3 to complete (in msecs)
+ //The Fade out and Score adding
- PopUpTex: array [0..8] of TTexture; // textures for every popup rating
+ PopUpTex: array [0..8] of TTexture; //Textures for every Popup Rating
- RatingBar_BG_Tex: TTexture; // rating bar texs
- RatingBar_FG_Tex: TTexture;
- RatingBar_Bar_Tex: TTexture;
+ RatingBar_BG_Tex: TTexture; //Rating Bar Texs
+ RatingBar_FG_Tex: TTexture;
+ RatingBar_Bar_Tex: TTexture;
end;
- Visible: boolean; // visibility of all scores
- Enabled: boolean; // scores are changed, popups are moved etc.
- RBVisible: boolean; // visibility of all rating bars
+ Visible: Boolean; //Visibility of all Scores
+ Enabled: Boolean; //Scores are changed, PopUps are Moved etc.
+ RBVisible: Boolean; //Visibility of all Rating Bars
- // properties for reading position and playercount
- property PositionCount: byte read oPositionCount;
- property PlayerCount: byte read oPlayerCount;
- property Players: aScorePlayer read aPlayers;
+ //Propertys for Reading Position and Playercount
+ property PositionCount: Byte read oPositionCount;
+ property PlayerCount: Byte read oPlayerCount;
+ property Players: aScorePlayer read aPlayers;
- // constructor just sets some standard settings
+ //Constructor just sets some standard Settings
constructor Create;
- // adds a position to array and increases position count
+ // Adds a Position to Array and Increases Position Count
procedure AddPosition(const pPosition: PScorePosition);
- // adds a player to array and increases player count
- procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word = 0; const Enabled: boolean = true; const Visible: boolean = true);
+ // Adds a Player to Array and Increases Player Count
+ procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True);
- // change a players visibility, enable
- procedure ChangePlayerVisibility(const Index: byte; const pVisible: boolean);
- procedure ChangePlayerEnabled(const Index: byte; const pEnabled: boolean);
+ //Change a Players Visibility, Enable
+ procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean);
+ procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean);
- // deletes all player information
+ // Deletes all Player Information
procedure ClearPlayers;
- // deletes positions and playerinformation
+ // Deletes Positions and Playerinformation
procedure Clear;
- // loads some settings and the positions from theme
+ // Loads some Settings and the Positions from Theme
procedure LoadfromTheme;
- // has to be called after positions and players have been added, before first call of draw
- // it gives every player a score position
+ // has to be called after Positions and Players have been added, before first call of Draw
+ //It gives every Player a Score Position
procedure Init;
- // spawns a new line bonus popup for the player
- procedure SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
+ //Spawns a new Line Bonus PopUp for the Player
+ procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word);
- // removes all popups from mem
+ //Removes all PopUps from Mem
procedure KillAllPopUps;
- // draws scores and line bonus popups
+ // Draws Scores and Linebonus PopUps
procedure Draw;
end;
+
implementation
-uses
- SysUtils,
- SDL,
- TextGL,
- ULog,
- UGraphic;
+uses SDL,
+ SysUtils,
+ ULog,
+ UGraphic,
+ TextGL;
{**
- * sets some standard settings
+ * Sets some standard Settings
*}
-constructor TSingScores.Create;
+Constructor TSingScores.Create;
begin
inherited;
- // clear popuplist pointers
+ //Clear PopupList Pointers
FirstPopUp := nil;
LastPopUp := nil;
- // clear variables
- Visible := true;
- Enabled := true;
- RBVisible := true;
+ //Clear Variables
+ Visible := True;
+ Enabled := True;
+ RBVisible := True;
- // clear position index
- oPositionCount := 0;
- oPlayerCount := 0;
+ //Clear Position Index
+ oPositionCount := 0;
+ oPlayerCount := 0;
Settings.Phase1Time := 350; // plop it up . -> [ ]
Settings.Phase2Time := 550; // shift it up ^[ ]^
@@ -260,21 +260,22 @@ begin
end;
{**
- * adds a position to array and increases position count
+ * Adds a Position to Array and Increases Position Count
*}
-procedure TSingScores.AddPosition(const pPosition: PScorePosition);
+Procedure TSingScores.AddPosition(const pPosition: PScorePosition);
begin
if (PositionCount < MaxPositions) then
begin
Positions[PositionCount] := pPosition^;
+
Inc(oPositionCount);
end;
end;
{**
- * adds a player to array and increases player count
+ * Adds a Player to Array and Increases Player Count
*}
-procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word; const Enabled: boolean; const Visible: boolean);
+Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean);
begin
if (PlayerCount < MaxPlayers) then
begin
@@ -282,48 +283,48 @@ begin
aPlayers[PlayerCount].Enabled := Enabled;
aPlayers[PlayerCount].Visible := Visible;
aPlayers[PlayerCount].Score := Score;
- aPlayers[PlayerCount].ScoreDisplayed := Score;
+ aPlayers[PlayerCount].ScoreDisplayed := Score;
aPlayers[PlayerCount].ScoreBG := ScoreBG;
aPlayers[PlayerCount].Color := Color;
aPlayers[PlayerCount].RBPos := 0.5;
aPlayers[PlayerCount].RBTarget := 0.5;
- aPlayers[PlayerCount].RBVisible := true;
+ aPlayers[PlayerCount].RBVisible := True;
Inc(oPlayerCount);
end;
end;
{**
- * change a players visibility
+ * Change a Players Visibility
*}
-procedure TSingScores.ChangePlayerVisibility(const Index: byte; const pVisible: boolean);
+Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean);
begin
if (Index < MaxPlayers) then
aPlayers[Index].Visible := pVisible;
end;
{**
- * change player enabled
+ * Change Player Enabled
*}
-procedure TSingScores.ChangePlayerEnabled(const Index: byte; const pEnabled: boolean);
+Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean);
begin
if (Index < MaxPlayers) then
aPlayers[Index].Enabled := pEnabled;
end;
{**
- * procedure deletes all player information
+ * Procedure Deletes all Player Information
*}
-procedure TSingScores.ClearPlayers;
+Procedure TSingScores.ClearPlayers;
begin
KillAllPopUps;
oPlayerCount := 0;
end;
{**
- * procedure deletes positions and playerinformation
+ * Procedure Deletes Positions and Playerinformation
*}
-procedure TSingScores.Clear;
+Procedure TSingScores.Clear;
begin
KillAllPopUps;
oPlayerCount := 0;
@@ -331,16 +332,14 @@ begin
end;
{**
- * procedure loads some settings and the positions from theme
+ * Procedure Loads some Settings and the Positions from Theme
*}
-procedure TSingScores.LoadfromTheme;
-var
- I: integer;
- procedure AddbyStatics(const PC: byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText);
- var
- nPosition: TScorePosition;
+Procedure TSingScores.LoadfromTheme;
+var I: Integer;
+ Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText);
+ var nPosition: TScorePosition;
begin
- nPosition.PlayerCount := PC; // only for one player playing
+ nPosition.PlayerCount := PC; //Only for one Player Playing
nPosition.BGX := ScoreStatic.X;
nPosition.BGY := ScoreStatic.Y;
@@ -374,55 +373,54 @@ var
begin
Clear;
- // set textures
- // popup tex
- for I := 0 to 8 do
+ //Set Textures
+ //Popup Tex
+ For I := 0 to 8 do
Settings.PopUpTex[I] := Tex_SingLineBonusBack[I];
- // rating bar tex
+ //Rating Bar Tex
Settings.RatingBar_BG_Tex := Tex_SingBar_Back;
Settings.RatingBar_FG_Tex := Tex_SingBar_Front;
Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar;
- // load positions from theme
+ //Load Positions from Theme
- // player 1:
+ // Player1:
AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score);
AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore);
AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore);
- // player 2:
+ // Player2:
AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore);
AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore);
- // player 3:
+ // Player3:
AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3SingBar, Theme.Sing.TextP3RScore);
end;
{**
- * spawns a new line bonus popup for the player
+ * Spawns a new Line Bonus PopUp for the Player
*}
-procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
-var
- Cur: PScorePopUp;
+Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word);
+var Cur: PScorePopUp;
begin
if (PlayerIndex < PlayerCount) then
begin
- // get memory and add data
+ //Get Memory and Add Data
GetMem(Cur, SizeOf(TScorePopUp));
- Cur.Player := PlayerIndex;
+ Cur.Player := PlayerIndex;
Cur.TimeStamp := SDL_GetTicks;
- // limit rating value to 8
- // a higher value would cause a crash when selecting the bg texture
+ //limit rating value to 8
+ //a higher value would cause a crash when selecting the bg textur
if (Rating > 8) then
Cur.Rating := 8
else
Cur.Rating := Rating;
Cur.ScoreGiven:= 0;
- if (Players[PlayerIndex].Score < Score) then
+ If (Players[PlayerIndex].Score < Score) then
begin
Cur.ScoreDiff := Score - Players[PlayerIndex].Score;
aPlayers[PlayerIndex].Score := Score;
@@ -431,77 +429,77 @@ begin
Cur.ScoreDiff := 0;
Cur.Next := nil;
- // Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff));
+ //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff));
- // add it to the chain
+ //Add it to the Chain
if (FirstPopUp = nil) then
- // the first popup in the list
+ //the first PopUp in the List
FirstPopUp := Cur
else
- // second or earlier popup
+ //second or earlier popup
LastPopUp.Next := Cur;
- // set new popup to last popup in the list
+ //Set new Popup to Last PopUp in the List
LastPopUp := Cur;
end
else
- Log.LogError('TSingScores: Try to add popup for non-existing player');
+ Log.LogError('TSingScores: Try to add PopUp for not existing player');
end;
{**
- * removes a popup w/o destroying the list
+ * Removes a PopUp w/o destroying the List
*}
-procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
+Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
begin
- // give player the last points that missing till now
+ //Give Player the Last Points that missing till now
aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven;
- // change bars position
+ //Change Bars Position
if (Cur.ScoreDiff > 0) THEN
- begin // popup w/ scorechange -> give missing percentille
+ begin //Popup w/ scorechange -> give missing Percentille
aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
(Cur.ScoreDiff - Cur.ScoreGiven) / Cur.ScoreDiff
* (Cur.Rating / 20 - 0.26);
end
else
- begin // popup w/o scorechange -> give complete percentille
+ begin //Popup w/o scorechange -> give complete Percentille
aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
(Cur.Rating / 20 - 0.26);
end;
- if (aPlayers[Cur.Player].RBTarget > 1) then
+ If (aPlayers[Cur.Player].RBTarget > 1) then
aPlayers[Cur.Player].RBTarget := 1
else
- if (aPlayers[Cur.Player].RBTarget < 0) then
+ If (aPlayers[Cur.Player].RBTarget < 0) then
aPlayers[Cur.Player].RBTarget := 0;
- // if this is the first popup => make next popup the first
- if (Cur = FirstPopUp) then
+ //If this is the First PopUp => Make Next PopUp the First
+ If (Cur = FirstPopUp) then
FirstPopUp := Cur.Next
- // else => remove curent popup from chain
+ //Else => Remove Curent Popup from Chain
else
Last.Next := Cur.Next;
- // if this is the last popup, make popup before the last
- if (Cur = LastPopUp) then
+ //If this is the Last PopUp, Make PopUp before the Last
+ If (Cur = LastPopUp) then
LastPopUp := Last;
- // free the memory
+ //Free the Memory
FreeMem(Cur, SizeOf(TScorePopUp));
end;
{**
- * removes all popups from mem
+ * Removes all PopUps from Mem
*}
-procedure TSingScores.KillAllPopUps;
+Procedure TSingScores.KillAllPopUps;
var
Cur: PScorePopUp;
Last: PScorePopUp;
begin
Cur := FirstPopUp;
- // remove all popups:
- while (Cur <> nil) do
+ //Remove all PopUps:
+ While (Cur <> nil) do
begin
Last := Cur;
Cur := Cur.Next;
@@ -513,42 +511,40 @@ begin
end;
{**
- * has to be called after positions and players have been added, before first call of draw
- * it gives each player a score position
+ * Has to be called after Positions and Players have been added, before first call of Draw
+ * It gives every Player a Score Position
*}
-procedure TSingScores.Init;
+Procedure TSingScores.Init;
var
- PlC: array [0..1] of byte; // playercount first screen and second screen
- I, J: integer;
- MaxPlayersperScreen: byte;
- CurPlayer: byte;
-
- function GetPositionCountbyPlayerCount(bPlayerCount: byte): byte;
- var
- I: integer;
+ PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen
+ I, J: Integer;
+ MaxPlayersperScreen: Byte;
+ CurPlayer: Byte;
+
+ Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte;
+ var I: Integer;
begin
Result := 0;
bPlayerCount := 1 shl (bPlayerCount - 1);
- for I := 0 to PositionCount - 1 do
+ For I := 0 to PositionCount-1 do
begin
- if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then
+ If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then
Inc(Result);
end;
end;
- function GetPositionbyPlayernum(bPlayerCount, bPlayer: byte): byte;
- var
- I: integer;
+ Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte;
+ var I: Integer;
begin
bPlayerCount := 1 shl (bPlayerCount - 1);
- Result := High(byte);
+ Result := High(Byte);
- for I := 0 to PositionCount - 1 do
+ For I := 0 to PositionCount-1 do
begin
- if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then
+ If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then
begin
- if (bPlayer = 0) then
+ If (bPlayer = 0) then
begin
Result := I;
Break;
@@ -562,16 +558,17 @@ var
begin
MaxPlayersPerScreen := 0;
- for I := 1 to 6 do
+ For I := 1 to 6 do
begin
- // if there are enough positions -> write to maxplayers
- if (GetPositionCountbyPlayerCount(I) = I) then
+ //If there are enough Positions -> Write to MaxPlayers
+ If (GetPositionCountbyPlayerCount(I) = I) then
MaxPlayersPerScreen := I
else
Break;
end;
- // split players to both screens or display on one screen
+
+ //Split Players to both Screen or Display on One Screen
if (Screens = 2) and (MaxPlayersPerScreen < PlayerCount) then
begin
PlC[0] := PlayerCount div 2 + PlayerCount mod 2;
@@ -583,8 +580,9 @@ begin
PlC[1] := 0;
end;
- // check if there are enough positions for all players
- for I := 0 to Screens - 1 do
+
+ //Check if there are enough Positions for all Players
+ For I := 0 to Screens - 1 do
begin
if (PlC[I] > MaxPlayersperScreen) then
begin
@@ -594,34 +592,34 @@ begin
end;
CurPlayer := 0;
- // give every player a position
- for I := 0 to Screens - 1 do
- for J := 0 to PlC[I]-1 do
+ //Give every Player a Position
+ For I := 0 to Screens - 1 do
+ For J := 0 to PlC[I]-1 do
begin
- aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) or (I shl 7);
- // Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position));
+ aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7);
+ //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position));
Inc(CurPlayer);
end;
end;
{**
- * draws scores and linebonus popups
+ * Draws Scores and Linebonus PopUps
*}
-procedure TSingScores.Draw;
+Procedure TSingScores.Draw;
var
- I: integer;
- CurTime: cardinal;
+ I: Integer;
+ CurTime: Cardinal;
CurPopUp, LastPopUp: PScorePopUp;
begin
CurTime := SDL_GetTicks;
- if Visible then
+ If Visible then
begin
- // draw popups
+ //Draw Popups
LastPopUp := nil;
CurPopUp := FirstPopUp;
- while (CurPopUp <> nil) do
+ While (CurPopUp <> nil) do
begin
if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then
begin
@@ -640,64 +638,64 @@ begin
end;
- if (RBVisible) then
- // draw players w/ rating bar
- for I := 0 to PlayerCount-1 do
+ IF (RBVisible) then
+ //Draw Players w/ Rating Bar
+ For I := 0 to PlayerCount-1 do
begin
DrawScore(I);
DrawRatingBar(I);
end
else
- // draw players w/o rating bar
- for I := 0 to PlayerCount-1 do
+ //Draw Players w/o Rating Bar
+ For I := 0 to PlayerCount-1 do
begin
DrawScore(I);
end;
- end; // eo visible
+ end; //eo Visible
end;
{**
- * draws a popup by pointer
+ * Draws a Popup by Pointer
*}
-procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp);
+Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp);
var
- Progress: real;
- CurTime: cardinal;
- X, Y, W, H, Alpha: real;
- FontSize: real;
- FontOffset: real;
- TimeDiff: cardinal;
- PIndex: byte;
- TextLen: real;
- ScoretoAdd: word;
- PosDiff: real;
+ Progress: Real;
+ CurTime: Cardinal;
+ X, Y, W, H, Alpha: Real;
+ FontSize: integer;
+ FontOffset: Real;
+ TimeDiff: Cardinal;
+ PIndex: Byte;
+ TextLen: Real;
+ ScoretoAdd: Word;
+ PosDiff: Real;
begin
if (PopUp <> nil) then
begin
- // only draw if player has a position
+ //Only Draw if Player has a Position
PIndex := Players[PopUp.Player].Position;
- if PIndex <> High(byte) then
+ If PIndex <> high(byte) then
begin
- // only draw if player is on cur screen
- if ((Players[PopUp.Player].Position and 128) = 0) = (ScreenAct = 1) then
+ //Only Draw if Player is on Cur Screen
+ If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then
begin
CurTime := SDL_GetTicks;
- if not (Enabled and Players[PopUp.Player].Enabled) then
- // increase timestamp with tiem where there is no movement ...
+ If Not (Enabled AND Players[PopUp.Player].Enabled) then
+ //Increase Timestamp with TIem where there is no Movement ...
begin
- // Inc(PopUp.TimeStamp, LastRender);
+ //Inc(PopUp.TimeStamp, LastRender);
end;
TimeDiff := CurTime - PopUp.TimeStamp;
- // get position of popup
- PIndex := PIndex and 127;
+ //Get Position of PopUp
+ PIndex := PIndex AND 127;
- // check for phase ...
- if (TimeDiff <= Settings.Phase1Time) then
+ //Check for Phase ...
+ If (TimeDiff <= Settings.Phase1Time) then
begin
- // phase 1 - the ploping up
+ //Phase 1 - The Ploping up
Progress := TimeDiff / Settings.Phase1Time;
@@ -707,26 +705,26 @@ begin
X := Positions[PIndex].PUStartX + (Positions[PIndex].PUW - W)/2;
Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2;
- FontSize := Progress * Positions[PIndex].PUFontSize;
- FontOffset := (H - FontSize) / 2;
+ FontSize := Round(Progress * Positions[PIndex].PUFontSize);
+ FontOffset := (H - FontSize) / 2;
Alpha := 1;
end
- else if (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then
+ Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then
begin
- // phase 2 - the moving
+ //Phase 2 - The Moving
Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time;
W := Positions[PIndex].PUW;
H := Positions[PIndex].PUH;
PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX;
- if PosDiff > 0 then
+ If PosDiff > 0 then
PosDiff := PosDiff + W;
X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress);
PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY;
- if PosDiff < 0 then
+ If PosDiff < 0 then
PosDiff := PosDiff + Positions[PIndex].BGH;
Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress);
@@ -737,67 +735,65 @@ begin
else
begin
- // phase 3 - the fading out + score adding
+ //Phase 3 - The Fading out + Score adding
Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time;
- if (PopUp.Rating > 0) then
+ If (PopUp.Rating > 0) then
begin
- // add scores if player enabled
- if (Enabled and Players[PopUp.Player].Enabled) then
+ //Add Scores if Player Enabled
+ If (Enabled AND Players[PopUp.Player].Enabled) then
begin
ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven;
Inc(PopUp.ScoreGiven, ScoreToAdd);
aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd;
- // change bar positions
- if PopUp.ScoreDiff = 0 then
- Log.LogError('TSingScores.DrawPopUp', 'PopUp.ScoreDiff is 0 and we want to divide by it. No idea how this happens.')
- else
- aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26);
- if (aPlayers[PopUp.Player].RBTarget > 1) then
+ //Change Bars Position
+ aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26);
+ If (aPlayers[PopUp.Player].RBTarget > 1) then
aPlayers[PopUp.Player].RBTarget := 1
- else if (aPlayers[PopUp.Player].RBTarget < 0) then
+ else If (aPlayers[PopUp.Player].RBTarget < 0) then
aPlayers[PopUp.Player].RBTarget := 0;
end;
- // set positions etc.
- Alpha := 0.7 - 0.7 * Progress;
+ //Set Positions etc.
+ Alpha := 0.7 - 0.7 * Progress;
W := Positions[PIndex].PUW;
H := Positions[PIndex].PUH;
PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX;
- if (PosDiff > 0) then
+ If (PosDiff > 0) then
PosDiff := W
else
PosDiff := 0;
X := Positions[PIndex].PUTargetX + PosDiff * Progress;
PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY;
- if (PosDiff < 0) then
+ If (PosDiff < 0) then
PosDiff := -Positions[PIndex].BGH
else
PosDiff := 0;
- Y := Positions[PIndex].PUTargetY - PosDiff * (1 - Progress);
+ Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress);
FontSize := Positions[PIndex].PUFontSize;
FontOffset := (H - FontSize) / 2;
end
else
begin
- // here the effect that should be shown if a popup without score is drawn
- // and or spawn with the graphicobjects etc.
- // some work for blindy to do :p
+ //Here the Effect that Should be shown if a PopUp without Score is Drawn
+ //And or Spawn with the GraphicObjects etc.
+ //Some Work for Blindy to do :P
- // atm: just let it slide in the scores just like the normal popup
+ //ATM: Just Let it Slide in the Scores just like the Normal PopUp
Alpha := 0;
end;
end;
- // draw popup
- if (Alpha > 0) and (FontSize > 0) and (Players[PopUp.Player].Visible) then
+ //Draw PopUp
+
+ if (Alpha > 0) AND (Players[PopUp.Player].Visible) then
begin
- // draw bg:
+ //Draw BG:
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -815,46 +811,45 @@ begin
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- // set font style and size
+ //Set FontStyle and Size
SetFontStyle(Positions[PIndex].PUFont);
- SetFontItalic(false);
+ SetFontItalic(False);
SetFontSize(FontSize);
- SetFontReflection(false, 0);
- // draw text
+ //Draw Text
TextLen := glTextWidth(Theme.Sing.LineBonusText[PopUp.Rating]);
- // color and pos
+ //Color and Pos
SetFontPos (X + (W - TextLen) / 2, Y + FontOffset);
glColor4f(1, 1, 1, Alpha);
- // draw
+ //Draw
glPrint(Theme.Sing.LineBonusText[PopUp.Rating]);
- end; // eo alpha check
- end; // eo right screen
- end; // eo player has position
+ end; //eo Alpha check
+ end; //eo Right Screen
+ end; //eo Player has Position
end
else
- Log.LogError('TSingScores: Try to draw a non-existing popup');
+ Log.LogError('TSingScores: Try to Draw a not existing PopUp');
end;
{**
- * draws a score by playerindex
+ * Draws a Score by Playerindex
*}
-procedure TSingScores.DrawScore(const Index: integer);
+Procedure TSingScores.DrawScore(const Index: Integer);
var
Position: PScorePosition;
ScoreStr: String;
begin
- // only draw if player has a position
- if Players[Index].Position <> High(byte) then
+ //Only Draw if Player has a Position
+ If Players[Index].Position <> high(byte) then
begin
- // only draw if player is on cur screen
- if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1)) and Players[Index].Visible then
+ //Only Draw if Player is on Cur Screen
+ If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then
begin
Position := @Positions[Players[Index].Position and 127];
- // draw scorebg
+ //Draw ScoreBG
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -872,51 +867,50 @@ begin
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- // draw score text
+ //Draw Score Text
SetFontStyle(Position.TextFont);
- SetFontItalic(false);
+ SetFontItalic(False);
SetFontSize(Position.TextSize);
SetFontPos(Position.TextX, Position.TextY);
- SetFontReflection(false, 0);
ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0';
- while (Length(ScoreStr) < 5) do
+ While (Length(ScoreStr) < 5) do
ScoreStr := '0' + ScoreStr;
glPrint(ScoreStr);
- end; // eo right screen
- end; // eo player has position
+ end; //eo Right Screen
+ end; //eo Player has Position
end;
-procedure TSingScores.DrawRatingBar(const Index: integer);
+Procedure TSingScores.DrawRatingBar(const Index: Integer);
var
- Position: PScorePosition;
- R, G, B: real;
- Size, Diff: real;
+ Position: PScorePosition;
+ R,G,B, Size: Real;
+ Diff: Real;
begin
- // only draw if player has a position
- if Players[Index].Position <> High(byte) then
+ //Only Draw if Player has a Position
+ if Players[Index].Position <> high(byte) then
begin
- // only draw if player is on cur screen
+ //Only Draw if Player is on Cur Screen
if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1) and
Players[index].RBVisible and
Players[index].Visible) then
begin
Position := @Positions[Players[Index].Position and 127];
- if (Enabled and Players[Index].Enabled) then
+ if (Enabled AND Players[Index].Enabled) then
begin
- // move position if enabled
+ //Move Position if Enabled
Diff := Players[Index].RBTarget - Players[Index].RBPos;
- if (Abs(Diff) < 0.02) then
+ If(Abs(Diff) < 0.02) then
aPlayers[Index].RBPos := aPlayers[Index].RBTarget
else
aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1;
end;
- // get colors for rating bar
+ //Get Colors for RatingBar
if (Players[index].RBPos <= 0.22) then
begin
R := 1;
@@ -926,7 +920,7 @@ begin
else if (Players[index].RBPos <= 0.42) then
begin
R := 1;
- G := Players[index].RBPos * 5;
+ G := Players[index].RBPos*5;
B := 0;
end
else if (Players[index].RBPos <= 0.57) then
@@ -937,7 +931,7 @@ begin
end
else if (Players[index].RBPos <= 0.77) then
begin
- R := 1 - (Players[index].RBPos - 0.57) * 5;
+ R := 1-(Players[index].RBPos-0.57)*5;
G := 1;
B := 0;
end
@@ -948,12 +942,12 @@ begin
B := 0;
end;
- // enable all glfuncs needed
+ //Enable all glFuncs Needed
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- // draw rating bar bg
+ //Draw RatingBar BG
glColor4f(1, 1, 1, 0.8);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum);
@@ -971,7 +965,7 @@ begin
glVertex2f(Position.RBX+Position.RBW, Position.RBY);
glEnd;
- // draw rating bar itself
+ //Draw Rating bar itself
Size := Position.RBX + Position.RBW * Players[Index].RBPos;
glColor4f(R, G, B, 1);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum);
@@ -989,7 +983,7 @@ begin
glVertex2f(Size, Position.RBY);
glEnd;
- // draw rating bar fg (the thing with the 3 lines to get better readability)
+ //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability)
glColor4f(1, 1, 1, 0.6);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum);
glBegin(GL_QUADS);
@@ -1006,11 +1000,11 @@ begin
glVertex2f(Position.RBX + Position.RBW, Position.RBY);
glEnd;
- // disable all enabled glfuncs
+ //Disable all Enabled glFuncs
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- end; // eo Right Screen
- end; // eo Player has Position
+ end; //eo Right Screen
+ end; //eo Player has Position
end;
end.
diff --git a/unicode/src/base/USongs.pas b/unicode/src/base/USongs.pas
index e1fb6ca9..852ccfc4 100644
--- a/unicode/src/base/USongs.pas
+++ b/unicode/src/base/USongs.pas
@@ -73,35 +73,35 @@ type
);
TBPM = record
- BPM: real;
- StartBeat: real;
+ BPM: real;
+ StartBeat: real;
end;
TScore = record
- Name: widestring;
- Score: integer;
- Length: string;
+ Name: widestring;
+ Score: integer;
+ Length: string;
end;
{$IFDEF USE_PSEUDO_THREAD}
- TSongs = class(TPseudoThread)
+ TSongs = class( TPseudoThread )
{$ELSE}
- TSongs = class(TThread)
+ TSongs = class( TThread )
{$ENDIF}
private
- fNotify, fWatch: longint;
- fParseSongDirectory: boolean;
- fProcessing: boolean;
+ fNotify, fWatch : longint;
+ fParseSongDirectory : boolean;
+ fProcessing : boolean;
{$ifdef MSWINDOWS}
- fDirWatch: TDirectoryWatch;
+ fDirWatch : TDirectoryWatch;
{$endif}
procedure int_LoadSongList;
procedure DoDirChanged(Sender: TObject);
protected
procedure Execute; override;
public
- SongList: TList; // array of songs
- Selected: integer; // selected song index
+ SongList : TList; // array of songs
+ Selected : integer; // selected song index
constructor Create();
destructor Destroy(); override;
@@ -112,7 +112,7 @@ type
procedure BrowseXMLFiles(Dir: widestring);
procedure Sort(Order: integer);
function FindSongFile(Dir, Mask: widestring): widestring;
- property Processing: boolean read fProcessing;
+ property Processing : boolean read fProcessing;
end;
@@ -121,24 +121,24 @@ type
Selected: integer; // selected song index
Order: integer; // order type (0=title)
CatNumShow: integer; // Category Number being seen
- CatCount: integer; // Number of Categorys
+ CatCount: integer; //Number of Categorys
procedure SortSongs();
- procedure Refresh; // refreshes arrays by recreating them from Songs array
- procedure ShowCategory(Index: integer); // expands all songs in category
- procedure HideCategory(Index: integer); // hides all songs in category
- procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed
- procedure ShowCategoryList; // Hides all Songs And Show the List of all Categorys
- function FindNextVisible(SearchFrom: integer): integer; // Find Next visible Song
- function VisibleSongs: integer; // returns number of visible songs (for tabs)
- function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible)
-
- function SetFilter(FilterStr: UTF8String; Filter: TSongFilter): cardinal;
+ procedure Refresh; // refreshes arrays by recreating them from Songs array
+ procedure ShowCategory(Index: integer); // expands all songs in category
+ procedure HideCategory(Index: integer); // hides all songs in category
+ procedure ClickCategoryButton(Index: integer); // uses ShowCategory and HideCategory when needed
+ procedure ShowCategoryList; //Hides all Songs And Show the List of all Categorys
+ function FindNextVisible(SearchFrom:integer): integer; //Find Next visible Song
+ function VisibleSongs: integer; // returns number of visible songs (for tabs)
+ function VisibleIndex(Index: integer): integer; // returns visible song index (skips invisible)
+
+ function SetFilter(FilterStr: UTF8String; Filter: TSongFilter): Cardinal;
end;
var
- Songs: TSongs; // all songs
- CatSongs: TCatSongs; // categorized songs
+ Songs: TSongs; // all songs
+ CatSongs: TCatSongs; // categorized songs
const
IN_ACCESS = $00000001; //* File was accessed */
@@ -177,7 +177,7 @@ begin
// FIXME: threaded loading does not work this way.
// It will just cause crashes but nothing else at the moment.
-(*
+ (*
{$ifdef MSWINDOWS}
fDirWatch := TDirectoryWatch.create(nil);
fDirWatch.OnChange := DoDirChanged;
@@ -188,7 +188,7 @@ begin
// now we can start the thread
Resume();
-*)
+ *)
// until it is fixed, simply load the song-list
int_LoadSongList();
@@ -196,7 +196,7 @@ end;
destructor TSongs.Destroy();
begin
- FreeAndNil(SongList);
+ FreeAndNil( SongList );
inherited;
end;
@@ -207,7 +207,7 @@ end;
procedure TSongs.Execute();
var
- fChangeNotify: THandle;
+ fChangeNotify : THandle;
begin
{$IFDEF USE_PSEUDO_THREAD}
int_LoadSongList();
@@ -241,13 +241,13 @@ begin
for I := 0 to SongPaths.Count-1 do
BrowseDir(SongPaths[I]);
- if assigned(CatSongs) then
+ if assigned( CatSongs ) then
CatSongs.Refresh;
- if assigned(CatCovers) then
+ if assigned( CatCovers ) then
CatCovers.Load;
- //if assigned(Covers) then
+ //if assigned( Covers ) then
// Covers.Load;
if assigned(ScreenSong) then
@@ -273,81 +273,81 @@ end;
procedure TSongs.BrowseDir(Dir: widestring);
begin
- BrowseTXTFiles(Dir);
- BrowseXMLFiles(Dir);
+ BrowseTXTFiles(Dir);
+ BrowseXMLFiles(Dir);
end;
procedure TSongs.BrowseTXTFiles(Dir: widestring);
var
- i: integer;
- Files: TDirectoryEntryArray;
- lSong: TSong;
+ i : integer;
+ Files : TDirectoryEntryArray;
+ lSong : TSong;
begin
try
- Files := Platform.DirectoryFindFiles(Dir, '.txt', true)
+ Files := Platform.DirectoryFindFiles( Dir, '.txt', true)
except
Log.LogError('Couldn''t deal with directory/file: ' + Dir + ' in TSongs.BrowseTXTFiles')
end;
- for i := 0 to Length(Files) - 1 do
+ for i := 0 to Length(Files)-1 do
begin
if Files[i].IsDirectory then
begin
- BrowseTXTFiles(Dir + Files[i].Name + PathDelim); //Recursive Call
+ BrowseTXTFiles( Dir + Files[i].Name + PathDelim ); //Recursive Call
end
else
begin
- lSong := TSong.create(Dir + Files[i].Name);
+ lSong := TSong.create( Dir + Files[i].Name );
if lSong.Analyse then
- SongList.add(lSong)
+ SongList.add( lSong )
else
begin
Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".');
- freeandnil(lSong);
+ freeandnil( lSong );
end;
end;
end;
- SetLength(Files, 0);
+ SetLength( Files, 0);
end;
procedure TSongs.BrowseXMLFiles(Dir: widestring);
var
- i: integer;
- Files: TDirectoryEntryArray;
- lSong: TSong;
+ i : integer;
+ Files : TDirectoryEntryArray;
+ lSong : TSong;
begin
try
- Files := Platform.DirectoryFindFiles(Dir, '.xml', true)
+ Files := Platform.DirectoryFindFiles( Dir, '.xml', true)
except
Log.LogError('Couldn''t deal with directory/file: ' + Dir + ' in TSongs.BrowseXMLFiles')
end;
- for i := 0 to Length(Files) - 1 do
+ for i := 0 to Length(Files)-1 do
begin
if Files[i].IsDirectory then
begin
- BrowseXMLFiles(Dir + Files[i].Name + PathDelim); // Recursive Call
+ BrowseXMLFiles( Dir + Files[i].Name + PathDelim ); //Recursive Call
end
else
begin
- lSong := TSong.create(Dir + Files[i].Name);
+ lSong := TSong.create( Dir + Files[i].Name );
if lSong.AnalyseXML then
- SongList.add(lSong)
+ SongList.add( lSong )
else
begin
Log.LogError('AnalyseFile failed for "' + Files[i].Name + '".');
- freeandnil(lSong);
+ freeandnil( lSong );
end;
end;
end;
- SetLength(Files, 0);
+ SetLength( Files, 0);
end;
@@ -421,7 +421,7 @@ end;
function TSongs.FindSongFile(Dir, Mask: widestring): widestring;
var
- SR: TSearchRec; // for parsing song directory
+ SR: TSearchRec; // for parsing song directory
begin
Result := '';
if FindFirst(Dir + Mask, faDirectory, SR) = 0 then
@@ -490,13 +490,13 @@ var
Inc(Order);
CatIndex := Length(Song);
SetLength(Song, CatIndex+1);
- Song[CatIndex] := TSong.Create();
- Song[CatIndex].Artist := '[' + CategoryName + ']';
- Song[CatIndex].Main := true;
+ Song[CatIndex] := TSong.Create();
+ Song[CatIndex].Artist := '[' + CategoryName + ']';
+ Song[CatIndex].Main := true;
Song[CatIndex].OrderTyp := 0;
Song[CatIndex].OrderNum := Order;
- Song[CatIndex].Cover := CatCovers.GetCover(Ini.Sorting, CategoryName);
- Song[CatIndex].Visible := true;
+ Song[CatIndex].Cover := CatCovers.GetCover(Ini.Sorting, CategoryName);
+ Song[CatIndex].Visible := true;
// set number of songs in previous category
PrevCatBtnIndex := CatIndex - CatNumber - 1;
@@ -507,21 +507,21 @@ var
end;
begin
- CatNumShow := -1;
+ CatNumShow := -1;
SortSongs();
CurCategory := '';
- Order := 0;
- CatNumber := 0;
+ Order := 0;
+ CatNumber := 0;
// Note: do NOT set Letter to ' ', otherwise no category-button will be
// created for songs beginning with ' ' if songs of this category exist.
// TODO: trim song-properties so ' ' will not occur as first chararcter.
- Letter := 0;
+ Letter := 0;
// clear song-list
- for SongIndex := 0 to Songs.SongList.Count - 1 do
+ for SongIndex := 0 to Songs.SongList.Count-1 do
begin
// free category buttons
// Note: do NOT delete songs, they are just references to Songs.SongList entries
@@ -531,7 +531,7 @@ begin
end;
SetLength(Song, 0);
- for SongIndex := 0 to Songs.SongList.Count - 1 do
+ for SongIndex := 0 to Songs.SongList.Count-1 do
begin
CurSong := TSong(Songs.SongList[SongIndex]);
// if tabs are on, add section buttons for each new section
@@ -545,11 +545,11 @@ begin
// TODO: remove this block if it is not needed anymore
{
- if CurSection = 'Singstar Part 2' then CoverName := 'Singstar';
- if CurSection = 'Singstar German' then CoverName := 'Singstar';
- if CurSection = 'Singstar Spanish' then CoverName := 'Singstar';
- if CurSection = 'Singstar Italian' then CoverName := 'Singstar';
- if CurSection = 'Singstar French' then CoverName := 'Singstar';
+ if CurSection = 'Singstar Part 2' then CoverName := 'Singstar';
+ if CurSection = 'Singstar German' then CoverName := 'Singstar';
+ if CurSection = 'Singstar Spanish' then CoverName := 'Singstar';
+ if CurSection = 'Singstar Italian' then CoverName := 'Singstar';
+ if CurSection = 'Singstar French' then CoverName := 'Singstar';
if CurSection = 'Singstar 80s Polish' then CoverName := 'Singstar 80s';
}
@@ -668,14 +668,15 @@ begin
CurSong.Visible := true
else if (Ini.Tabs = 1) then
CurSong.Visible := false;
-{
+
+ {
if (Ini.Tabs = 1) and (Order = 1) then
begin
//open first tab
CurSong.Visible := true;
end;
CurSong.Visible := true;
-}
+ }
end;
// set CatNumber of last category
@@ -693,7 +694,7 @@ end;
procedure TCatSongs.ShowCategory(Index: integer);
var
- S: integer; // song
+ S: integer; // song
begin
CatNumShow := Index;
for S := 0 to high(CatSongs.Song) do
@@ -705,13 +706,13 @@ begin
CatSongs.Song[S].Visible := false;
}
// KMS: This should be the same, but who knows :-)
- CatSongs.Song[S].Visible := ((CatSongs.Song[S].OrderNum = Index) and (not CatSongs.Song[S].Main));
+ CatSongs.Song[S].Visible := ( (CatSongs.Song[S].OrderNum = Index) and (not CatSongs.Song[S].Main) );
end;
end;
procedure TCatSongs.HideCategory(Index: integer); // hides all songs in category
var
- S: integer; // song
+ S: integer; // song
begin
for S := 0 to high(CatSongs.Song) do
begin
@@ -722,7 +723,7 @@ end;
procedure TCatSongs.ClickCategoryButton(Index: integer);
var
- Num: integer;
+ Num: integer;
begin
Num := CatSongs.Song[Index].OrderNum;
if Num <> CatNumShow then
@@ -738,7 +739,7 @@ end;
//Hide Categorys when in Category Hack
procedure TCatSongs.ShowCategoryList;
var
- S: integer;
+ S: integer;
begin
// Hide All Songs Show All Cats
for S := 0 to high(CatSongs.Song) do
@@ -748,8 +749,8 @@ begin
end;
//Hide Categorys when in Category Hack End
-// Wrong song selected when tabs on bug
-function TCatSongs.FindNextVisible(SearchFrom:integer): integer;// Find next Visible Song
+//Wrong song selected when tabs on bug
+function TCatSongs.FindNextVisible(SearchFrom:integer): integer;//Find next Visible Song
var
I: integer;
begin
@@ -760,11 +761,11 @@ begin
Inc (I);
if (I>high(CatSongs.Song)) then
I := low(CatSongs.Song);
- if (I = SearchFrom) then // Make One Round and no song found->quit
+ if (I = SearchFrom) then //Make One Round and no song found->quit
break;
end;
end;
-// Wrong song selected when tabs on bug End
+//Wrong song selected when tabs on bug End
(**
* Returns the number of visible songs.
@@ -790,20 +791,19 @@ var
SongIndex: integer;
begin
Result := 0;
- for SongIndex := 0 to Index - 1 do
+ for SongIndex := 0 to Index-1 do
begin
if (CatSongs.Song[SongIndex].Visible) then
Inc(Result);
end;
end;
-function TCatSongs.SetFilter(FilterStr: UTF8String; Filter: TSongFilter): cardinal;
+function TCatSongs.SetFilter(FilterStr: UTF8String; Filter: TSongFilter): Cardinal;
var
- I, J: integer;
+ I, J: integer;
TmpString: UTF8String;
WordArray: array of UTF8String;
begin
-
FilterStr := Trim(FilterStr);
if (FilterStr <> '') then
begin
@@ -838,7 +838,7 @@ begin
fltArtist:
TmpString := Song[I].Artist;
end;
- Song[i].Visible:=true;
+ Song[i].Visible:=True;
// Look for every Searched Word
for J := 0 to High(WordArray) do
begin
@@ -849,7 +849,7 @@ begin
Inc(Result);
end
else
- Song[i].Visible := false;
+ Song[i].Visible := False;
end;
CatNumShow := -2;
end
diff --git a/unicode/src/base/UTexture.pas b/unicode/src/base/UTexture.pas
index 97f244fe..962bd2b0 100644
--- a/unicode/src/base/UTexture.pas
+++ b/unicode/src/base/UTexture.pas
@@ -336,8 +336,8 @@ begin
X := 0;
Y := 0;
Z := 0;
- W := oldWidth;
- H := oldHeight;
+ W := 0;
+ H := 0;
ScaleW := 1;
ScaleH := 1;
Rot := 0;
diff --git a/unicode/src/base/UThemes.pas b/unicode/src/base/UThemes.pas
index 3fd77853..9bf858ed 100644
--- a/unicode/src/base/UThemes.pas
+++ b/unicode/src/base/UThemes.pas
@@ -42,13 +42,13 @@ uses
type
TRGB = record
- R: single;
- G: single;
- B: single;
+ R: single;
+ G: single;
+ B: single;
end;
TRGBA = record
- R, G, B, A: double;
+ R, G, B, A: Double;
end;
type
@@ -175,12 +175,11 @@ type
W: integer;
H: integer;
Z: real;
- SBGW: integer;
TextSize: integer;
- showArrows:boolean;
- oneItemOnly:boolean;
+ //SBGW Mod
+ SBGW: integer;
Text: string;
ColR, ColG, ColB, Int: real;
@@ -360,11 +359,6 @@ type
PausePopUp: TThemeStatic;
end;
- TThemeLyricBar = record
- IndicatorYOffset, UpperX, UpperW, UpperY, UpperH,
- LowerX, LowerW, LowerY, LowerH : integer;
- end;
-
TThemeScore = class(TThemeBasic)
TextArtist: TThemeText;
TextTitle: TThemeText;
@@ -729,7 +723,6 @@ type
Level: TThemeLevel;
Song: TThemeSong;
Sing: TThemeSing;
- LyricBar: TThemeLyricBar;
Score: TThemeScore;
Top5: TThemeTop5;
Options: TThemeOptions;
@@ -1038,19 +1031,9 @@ begin
ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5');
- //LyricBar asd
- LyricBar.UpperX := ThemeIni.ReadInteger('SingLyricsUpperBar', 'X', 0);
- LyricBar.UpperW := ThemeIni.ReadInteger('SingLyricsUpperBar', 'W', 0);
- LyricBar.UpperY := ThemeIni.ReadInteger('SingLyricsUpperBar', 'Y', 0);
- LyricBar.UpperH := ThemeIni.ReadInteger('SingLyricsUpperBar', 'H', 0);
- LyricBar.IndicatorYOffset := ThemeIni.ReadInteger('SingLyricsUpperBar', 'IndicatorYOffset', 0);
- LyricBar.LowerX := ThemeIni.ReadInteger('SingLyricsLowerBar', 'X', 0);
- LyricBar.LowerW := ThemeIni.ReadInteger('SingLyricsLowerBar', 'W', 0);
- LyricBar.LowerY := ThemeIni.ReadInteger('SingLyricsLowerBar', 'Y', 0);
- LyricBar.LowerH := ThemeIni.ReadInteger('SingLyricsLowerBar', 'H', 0);
-
// Sing
ThemeLoadBasic(Sing, 'Sing');
+
//TimeBar mod
ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress');
ThemeLoadText(Sing.TextTimeText, 'SingTimeText');
@@ -1786,7 +1769,7 @@ begin
ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0);
- ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400);
+ ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450);
LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', ''));
ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1);
diff --git a/unicode/src/base/UTime.pas b/unicode/src/base/UTime.pas
index 83844cb5..3f35dffd 100644
--- a/unicode/src/base/UTime.pas
+++ b/unicode/src/base/UTime.pas
@@ -61,20 +61,20 @@ procedure CountSkipTime;
procedure CountMidTime;
var
- USTime: TTime;
+ USTime : TTime;
VideoBGTimer: TRelativeTimer;
- TimeNew: int64;
- TimeOld: int64;
- TimeSkip: real;
- TimeMid: real;
- TimeMidTemp: int64;
+ TimeNew : int64;
+ TimeOld : int64;
+ TimeSkip : real;
+ TimeMid : real;
+ TimeMidTemp : int64;
implementation
uses
sdl,
- UCommon;
+ ucommon;
const
cSDLCorrectionRatio = 1000;
@@ -91,14 +91,14 @@ http://www.gamedev.net/community/forums/topic.asp?topic_id=466145&whichpage=1%EE
procedure CountSkipTimeSet;
begin
- TimeNew := SDL_GetTicks();
+ TimeNew := SDL_GetTicks();
end;
procedure CountSkipTime;
begin
- TimeOld := TimeNew;
- TimeNew := SDL_GetTicks();
- TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
+ TimeOld := TimeNew;
+ TimeNew := SDL_GetTicks();
+ TimeSkip := (TimeNew-TimeOld) / cSDLCorrectionRatio;
end;
procedure CountMidTime;
@@ -127,10 +127,10 @@ end;
**}
(*
- * creates a new timer.
- * if triggermode is false (default), the timer
+ * Creates a new timer.
+ * If TriggerMode is false (default), the timer
* will immediately begin with counting.
- * if triggermode is true, it will wait until get/settime() or pause() is called
+ * If TriggerMode is true, it will wait until Get/SetTime() or Pause() is called
* for the first time.
*)
constructor TRelativeTimer.Create(TriggerMode: boolean);