aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/src/base')
-rw-r--r--cmake/src/base/UBeatTimer.pas170
-rw-r--r--cmake/src/base/UCommon.pas98
-rw-r--r--cmake/src/base/UDraw.pas2
-rw-r--r--cmake/src/base/UGraphic.pas34
-rw-r--r--cmake/src/base/UImage.pas41
-rw-r--r--cmake/src/base/UIni.pas262
-rw-r--r--cmake/src/base/UMain.pas81
-rw-r--r--cmake/src/base/UMusic.pas134
-rw-r--r--cmake/src/base/USingScores.pas643
-rw-r--r--cmake/src/base/UTexture.pas4
-rw-r--r--cmake/src/base/UThemes.pas33
-rw-r--r--cmake/src/base/UTime.pas28
12 files changed, 948 insertions, 582 deletions
diff --git a/cmake/src/base/UBeatTimer.pas b/cmake/src/base/UBeatTimer.pas
new file mode 100644
index 00000000..a47a06f9
--- /dev/null
+++ b/cmake/src/base/UBeatTimer.pas
@@ -0,0 +1,170 @@
+ {* UltraStar Deluxe - Karaoke Game
+ *
+ * UltraStar Deluxe is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ * $URL: 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/cmake/src/base/UCommon.pas b/cmake/src/base/UCommon.pas
index a52349c0..d729b6dd 100644
--- a/cmake/src/base/UCommon.pas
+++ b/cmake/src/base/UCommon.pas
@@ -44,28 +44,28 @@ 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}
-function StringReplaceW(text : WideString; search, rep: WideChar):WideString;
-function AdaptFilePaths( const aPath : widestring ): widestring;
+function StringReplaceW(text: WideString; search, rep: WideChar): WideString;
+function AdaptFilePaths(const aPath: WideString): WideString;
procedure DisableFloatingPointExceptions();
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;
(*
#define LOBYTE(a) (BYTE)(a)
#define HIBYTE(a) (BYTE)((a)>>8)
@@ -90,8 +90,8 @@ function IsControlChar(ch: WideChar): 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
@@ -224,10 +224,10 @@ begin
exOverflow, exUnderflow, exPrecision]);
end;
-function StringReplaceW(text : WideString; search, rep: WideChar) : WideString;
+function StringReplaceW(text: WideString; search, rep: WideChar): WideString;
var
- iPos : integer;
-// sTemp : WideString;
+ iPos: integer;
+// sTemp: WideString;
begin
(*
result := text;
@@ -251,25 +251,25 @@ begin
end;
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;
(*
-function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER):Bool;
+function QueryPerformanceCounter(lpPerformanceCount:TLARGEINTEGER): Bool;
// From http://en.wikipedia.org/wiki/RDTSC
function RDTSC: Int64; register;
@@ -310,7 +310,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
@@ -330,14 +330,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.
@@ -345,30 +345,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;
@@ -397,12 +397,10 @@ begin
end;
end;
-
-
{$IFDEF FPC}
-function RandomRange(aMin: Integer; aMax: Integer) : Integer;
+function RandomRange(aMin: integer; aMax: integer): integer;
begin
- RandomRange := Random(aMax-aMin) + aMin ;
+ RandomRange := Random(aMax - aMin) + aMin ;
end;
{$ENDIF}
@@ -455,7 +453,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;
@@ -528,7 +526,7 @@ end;
procedure ShowMessage(const msg: String; msgType: TMessageType);
{$IFDEF MSWINDOWS}
-var Flags: Cardinal;
+var Flags: cardinal;
{$ENDIF}
begin
{$IF Defined(MSWINDOWS)}
@@ -607,7 +605,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
@@ -683,7 +681,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
@@ -699,9 +697,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
@@ -722,9 +720,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;
@@ -732,7 +730,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/cmake/src/base/UDraw.pas b/cmake/src/base/UDraw.pas
index 8a66d271..1783986f 100644
--- a/cmake/src/base/UDraw.pas
+++ b/cmake/src/base/UDraw.pas
@@ -638,7 +638,7 @@ begin
// determine lyric help bar position and size
Bounds.Left := MoveStartX + BarProgress * MoveDist;
Bounds.Right := Bounds.Left + BarWidth;
- Bounds.Top := Skin_LyricsT + 3;
+ Bounds.Top := Theme.LyricBar.IndicatorYOffset + Theme.LyricBar.UpperY ;
Bounds.Bottom := Bounds.Top + BarHeight + 3;
// draw lyric help bar
diff --git a/cmake/src/base/UGraphic.pas b/cmake/src/base/UGraphic.pas
index 17175d02..818e49aa 100644
--- a/cmake/src/base/UGraphic.pas
+++ b/cmake/src/base/UGraphic.pas
@@ -198,7 +198,14 @@ var
Tex_Score_NoteBarRound_Lightest : array [1..6] of TTexture;
Tex_Score_Ratings : array [0..7] of TTexture;
-
+
+ // arrows for SelectSlide
+ Tex_SelectS_ArrowL: TTexture;
+ Tex_SelectS_ArrowR: TTexture;
+
+ // textures for software mouse cursor
+ Tex_Cursor_Unpressed: TTexture;
+ Tex_Cursor_Pressed: TTexture;
const
Skin_BGColorR = 1;
Skin_BGColorG = 1;
@@ -232,17 +239,6 @@ const
Skin_OscG = 0;
Skin_OscB = 0;
- // TODO: add to theme ini file
- Skin_LyricsT = 493;
- Skin_LyricsUpperX = 80;
- Skin_LyricsUpperW = 640;
- Skin_LyricsUpperY = Skin_LyricsT;
- Skin_LyricsUpperH = 41;
- Skin_LyricsLowerX = 80;
- Skin_LyricsLowerW = 640;
- Skin_LyricsLowerY = Skin_LyricsT + Skin_LyricsUpperH + 1;
- Skin_LyricsLowerH = 41;
-
Skin_SpectrumT = 470;
Skin_SpectrumBot = 570;
Skin_SpectrumH = 100;
@@ -339,6 +335,15 @@ begin
Tex_Ball := Texture.LoadTexture(Skin.GetTextureFileName('Ball'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
Tex_Lyric_Help_Bar := Texture.LoadTexture(Skin.GetTextureFileName('LyricHelpBar'), TEXTURE_TYPE_TRANSPARENT, $FF00FF);
+ Tex_SelectS_ArrowL := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowLeft'), TEXTURE_TYPE_TRANSPARENT, 0);
+ Tex_SelectS_ArrowR := Texture.LoadTexture(Skin.GetTextureFileName('Select_ArrowRight'), TEXTURE_TYPE_TRANSPARENT, 0);
+
+ Tex_Cursor_Unpressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor'), TEXTURE_TYPE_TRANSPARENT, 0);
+
+ if (Skin.GetTextureFileName('Cursor_Pressed') <> '') then
+ Tex_Cursor_Pressed := Texture.LoadTexture(Skin.GetTextureFileName('Cursor_Pressed'), TEXTURE_TYPE_TRANSPARENT, 0)
+ else
+ Tex_Cursor_Pressed.TexNum := 0;
//TimeBar mod
Tex_TimeProgress := Texture.LoadTexture(Skin.GetTextureFileName('TimeBar'));
@@ -497,6 +502,7 @@ begin
Log.LogStatus('TDisplay.Create', 'UGraphic.Initialize3D');
Display := TDisplay.Create;
+ //Display.SetCursor;
//Log.BenchmarkEnd(2); Log.LogBenchmark('====> Creating Display', 2);
@@ -629,15 +635,15 @@ begin
begin
Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Full Screen');
screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN );
- SDL_ShowCursor(0);
end
else
begin
Log.LogStatus('SDL_SetVideoMode', 'Set Video Mode... Windowed');
screen := SDL_SetVideoMode(W, H, 0, SDL_OPENGL or SDL_RESIZABLE);
- SDL_ShowCursor(1);
end;
+ SDL_ShowCursor(0);
+
if (screen = nil) then
begin
Log.LogCritical('SDL_SetVideoMode Failed', 'Initialize3D');
diff --git a/cmake/src/base/UImage.pas b/cmake/src/base/UImage.pas
index 8dc38495..60b0a3a2 100644
--- a/cmake/src/base/UImage.pas
+++ b/cmake/src/base/UImage.pas
@@ -311,13 +311,13 @@ var
hour, minute, second, msecond: word;
begin
DecodeDate(time, year, month, day);
- pngTime.year := year;
- pngTime.month := month;
- pngTime.day := day;
+ pngTime.year := png_uint_16(year);
+ pngTime.month := png_byte(month);
+ pngTime.day := png_byte(day);
DecodeTime(time, hour, minute, second, msecond);
- pngTime.hour := hour;
- pngTime.minute := minute;
- pngTime.second := second;
+ pngTime.hour := png_byte(hour);
+ pngTime.minute := png_byte(minute);
+ pngTime.second := png_byte(second);
end;
(*
@@ -896,8 +896,13 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
// replaced by division of longwords, shifted by 10 bits to keep
// digits.
+ // The use of longwards leeds to some type size mismatch warnings
+ // whenever differences are formed.
+ // This should not be a problem, since the results should all be positive.
+ // replacing longword by longint would probably resolve this cosmetic fault :-)
+
function ColorToHue(const Color: longword): longword;
- // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024
+ // returns hue within the range [0.0-6.0] but shl 10, ie. times 1024
var
Red, Green, Blue: longword;
Min, Max, Delta: longword;
@@ -919,7 +924,8 @@ procedure ColorizeImage(ImgSurface: PSDL_Surface; NewColor: cardinal);
if Blue > Max then Max := Blue;
// calc hue
- Delta := Max - Min;
+ Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0
+ // But the assignments above are easy enough to be sure, that Max - Min is >= 0.
if (Delta = 0) then
Result := 0
else
@@ -1023,16 +1029,19 @@ begin
end
else // all colors except black and white
begin
- Delta := Max - Min;
+ Delta := Max - Min; // This gives a type size mismatch warning, because Delta is longword, ie. >= 0
+ // But the assignments above are easy enough to be sure, that Max - Min is >= 0.
Sat := (Delta shl 10) div Max; // shl 10
- // shr 10 corrects that sat and f are shl 10
+ // shr 10 corrects that Sat and f are shl 10
// the resulting p, q and t are unshifted
p := (Max*(1024-Sat)) shr 10;
q := (Max*(1024-(Sat*f) shr 10)) shr 10;
t := (Max*(1024-(Sat*(1024-f)) shr 10)) shr 10;
+ // The above 3 lines give type size mismatch warning, but all variables are longword and the ranges should be ok.
+
case HueInteger of
0: begin Red := Max; Green := t; Blue := p; end; // (v,t,p)
1: begin Red := q; Green := Max; Blue := p; end; // (q,v,p)
@@ -1043,13 +1052,13 @@ begin
end;
{$IFDEF FPC_BIG_ENDIAN}
- PixelColors[3] := Red;
- PixelColors[2] := Green;
- PixelColors[1] := Blue
+ PixelColors[3] := byte(Red);
+ PixelColors[2] := byte(Green);
+ PixelColors[1] := byte(Blue);
{$ELSE}
- PixelColors[0] := Red;
- PixelColors[1] := Green;
- PixelColors[2] := Blue;
+ PixelColors[0] := byte(Red);
+ PixelColors[1] := byte(Green);
+ PixelColors[2] := byte(Blue);
{$ENDIF}
end;
diff --git a/cmake/src/base/UIni.pas b/cmake/src/base/UIni.pas
index 2c1029f6..2bcc7305 100644
--- a/cmake/src/base/UIni.pas
+++ b/cmake/src/base/UIni.pas
@@ -77,6 +77,7 @@ 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);
@@ -154,6 +155,7 @@ type
// Controller
Joypad: integer;
+ Mouse: integer;
procedure Load();
procedure Save();
@@ -200,8 +202,7 @@ const
ISingWindow: array[0..1] of string = ('Small', 'Big');
//SingBar Mod
- IOscilloscope: array[0..2] of string = ('Off', 'Osci', 'Bar');
-//IOscilloscope: array[0..1] of string = ('Off', 'On');
+ IOscilloscope: array[0..1] of string = ('Off', 'On');
ISpectrum: array[0..1] of string = ('Off', 'On');
ISpectrograph: array[0..1] of string = ('Off', 'On');
@@ -242,15 +243,75 @@ const
IScreenFade: array[0..1] of string = ('Off', 'On');
IAskbeforeDel: array[0..1] of string = ('Off', 'On');
IOnSongClick: array[0..2] of string = ('Sing', 'Select Players', 'Open Menu');
- ILineBonus: array[0..2] of string = ('Off', 'At Score', 'At Notes');
+ ILineBonus: array[0..1] of string = ('Off', 'On');
IPartyPopup: array[0..1] of string = ('Off', 'On');
IJoypad: array[0..1] of string = ('Off', 'On');
+ IMouse: array[0..2] of string = ('Off', 'Hardware Cursor', 'Software Cursor');
// Recording options
IChannelPlayer: array[0..6] of string = ('Off', '1', '2', '3', '4', '5', '6');
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
@@ -265,6 +326,188 @@ uses
UPath;
(**
+ * 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;
@@ -588,6 +831,7 @@ 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]);
@@ -681,7 +925,7 @@ begin
SingWindow := GetArrayIndex(ISingWindow, IniFile.ReadString('Graphics', 'SingWindow', 'Big'));
// Oscilloscope
- Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', 'Bar'));
+ Oscilloscope := GetArrayIndex(IOscilloscope, IniFile.ReadString('Graphics', 'Oscilloscope', IOscilloscope[0]));
// Spectrum
Spectrum := GetArrayIndex(ISpectrum, IniFile.ReadString('Graphics', 'Spectrum', 'Off'));
@@ -761,7 +1005,7 @@ begin
OnSongClick := GetArrayIndex(IOnSongClick, IniFile.ReadString('Advanced', 'OnSongClick', 'Sing'));
// Linebonus
- LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', 'At Score'));
+ LineBonus := GetArrayIndex(ILineBonus, IniFile.ReadString('Advanced', 'LineBonus', ILineBonus[1]));
// PartyPopup
PartyPopup := GetArrayIndex(IPartyPopup, IniFile.ReadString('Advanced', 'PartyPopup', 'On'));
@@ -769,8 +1013,13 @@ 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;
@@ -908,6 +1157,9 @@ begin
// Joypad
IniFile.WriteString('Controller', 'Joypad', IJoypad[Joypad]);
+ // Mouse
+ IniFile.WriteString('Controller', 'Mouse', IMouse[Mouse]);
+
// Directories (add a template if section is missing)
// Note: Value must be ' ' and not '', otherwise no key is generated on Linux
if (not IniFile.SectionExists('Directories')) then
diff --git a/cmake/src/base/UMain.pas b/cmake/src/base/UMain.pas
index 469a658b..275510fc 100644
--- a/cmake/src/base/UMain.pas
+++ b/cmake/src/base/UMain.pas
@@ -83,6 +83,7 @@ uses
UPath,
UPlaylist,
UMusic,
+ UBeatTimer,
UPlatform,
USkins,
USongs,
@@ -358,9 +359,11 @@ begin
CountMidTime;
Delay := Floor(1000 / MAX_FPS - 1000 * TimeMid);
+ Log.LogError ('MainLoop', 'Delay: ' + intToStr(Delay));
if Delay >= 1 then
SDL_Delay(Delay); // dynamic, maximum is 100 fps
+ Log.LogError ('MainLoop', 'Delay: ok ' + intToStr(Delay));
CountSkipTime;
@@ -374,9 +377,26 @@ begin
end;
end;
+procedure DoQuit;
+begin
+ // if question option is enabled then show exit popup
+ if (Ini.AskbeforeDel = 1) then
+ begin
+ Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX');
+ end
+ else // if ask-for-exit is disabled then simply exit
+ begin
+ Display.Fade := 0;
+ Display.NextScreenWithCheck := nil;
+ Display.CheckOK := true;
+ end;
+end;
+
procedure CheckEvents;
var
- Event: TSDL_event;
+ Event: TSDL_event;
+ mouseDown: boolean;
+ mouseBtn: integer;
begin
if Assigned(Display.NextScreen) then
Exit;
@@ -390,17 +410,46 @@ begin
Display.NextScreenWithCheck := nil;
Display.CheckOK := true;
end;
- SDL_MOUSEBUTTONDOWN:
+
+ SDL_MOUSEMOTION, SDL_MOUSEBUTTONDOWN, SDL_MOUSEBUTTONUP:
begin
-{
- with Event.button do
+ if (Ini.Mouse > 0) then
begin
- if State = SDL_BUTTON_LEFT then
+ case Event.type_ of
+ SDL_MOUSEMOTION:
+ begin
+ mouseDown := false;
+ mouseBtn := 0;
+ end;
+ SDL_MOUSEBUTTONDOWN:
+ begin
+ mouseDown := true;
+ mouseBtn := Event.button.button;
+ end;
+ SDL_MOUSEBUTTONUP:
+ begin
+ mouseDown := false;
+ mouseBtn := Event.button.button;
+ end;
+ end;
+
+ Display.MoveCursor(Event.button.X * 800 / Screen.w,
+ Event.button.Y * 600 / Screen.h,
+ mouseDown and ((mouseBtn <> SDL_BUTTON_WHEELDOWN) or (mouseBtn <> SDL_BUTTON_WHEELUP)));
+
+ if (ScreenPopupError <> nil) and (ScreenPopupError.Visible) then
+ done := not ScreenPopupError.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y)
+ else if (ScreenPopupCheck <> nil) and (ScreenPopupCheck.Visible) then
+ done := not ScreenPopupCheck.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y)
+ else
begin
- //
+ done := not Display.CurrentScreen^.ParseMouse(mouseBtn, mouseDown, Event.button.x, Event.button.y);
+
+ // if screen wants to exit
+ if done then
+ DoQuit;
end;
end;
-}
end;
SDL_VIDEORESIZE:
begin
@@ -436,14 +485,14 @@ begin
if boolean( Ini.FullScreen ) then
begin
SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN);
- SDL_ShowCursor(0);
end
else
begin
SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_RESIZABLE);
- SDL_ShowCursor(1);
end;
+ Display.SetCursor;
+
glViewPort(0, 0, ScreenW, ScreenH);
{$IFEND}
end
@@ -463,19 +512,7 @@ begin
// if screen wants to exit
if Done then
- begin
- // if question option is enabled then show exit popup
- if (Ini.AskbeforeDel = 1) then
- begin
- Display.CurrentScreen^.CheckFadeTo(nil,'MSG_QUIT_USDX');
- end
- else // if ask-for-exit is disabled then simply exit
- begin
- Display.Fade := 0;
- Display.NextScreenWithCheck := nil;
- Display.CheckOK := true;
- end;
- end;
+ DoQuit;
end;
end;
diff --git a/cmake/src/base/UMusic.pas b/cmake/src/base/UMusic.pas
index b86f3aad..19c54bee 100644
--- a/cmake/src/base/UMusic.pas
+++ b/cmake/src/base/UMusic.pas
@@ -36,7 +36,8 @@ interface
uses
UTime,
SysUtils,
- Classes;
+ Classes,
+ UBeatTimer;
type
TNoteType = (ntFreestyle, ntNormal, ntGolden);
@@ -99,51 +100,6 @@ type
Line: array of TLine;
end;
- (**
- * TLyricsState contains all information concerning the
- * state of the lyrics, e.g. the current beat or duration of the lyrics.
- *)
- TLyricsState = class
- private
- Timer: TRelativeTimer; // keeps track of the current time
- public
- OldBeat: integer; // previous discovered beat
- CurrentBeat: integer; // current beat (rounded)
- MidBeat: real; // current beat (float)
-
- // now we use this for super synchronization!
- // only used when analyzing voice
- // TODO: change ...D to ...Detect(ed)
- OldBeatD: integer; // previous discovered beat
- CurrentBeatD: integer; // current discovered beat (rounded)
- MidBeatD: real; // current discovered beat (float)
-
- // we use this for audible clicks
- // TODO: Change ...C to ...Click
- OldBeatC: integer; // previous discovered beat
- CurrentBeatC: integer;
- MidBeatC: real; // like CurrentBeatC
-
- OldLine: integer; // previous displayed sentence
-
- StartTime: real; // time till start of lyrics (= Gap)
- TotalTime: real; // total song time
-
- constructor Create();
- procedure Pause();
- procedure Resume();
-
- procedure Reset();
- procedure UpdateBeats();
-
- (**
- * current song time (in seconds) used as base-timer for lyrics etc.
- *)
- function GetCurrentTime(): real;
- procedure SetCurrentTime(Time: real);
- end;
-
-
const
FFTSize = 512; // size of FFT data (output: FFTSize/2 values)
type
@@ -977,92 +933,6 @@ begin
end;
end;
-
-{ TVoiceRemoval }
-
-constructor TLyricsState.Create();
-begin
- // create a triggered timer, so we can Pause() it, set the time
- // and Resume() it afterwards for better synching.
- Timer := TRelativeTimer.Create(true);
-
- // reset state
- Reset();
-end;
-
-procedure TLyricsState.Pause();
-begin
- Timer.Pause();
-end;
-
-procedure TLyricsState.Resume();
-begin
- Timer.Resume();
-end;
-
-procedure TLyricsState.SetCurrentTime(Time: real);
-begin
- // do not start the timer (if not started already),
- // after setting the current time
- Timer.SetTime(Time, false);
-end;
-
-function TLyricsState.GetCurrentTime(): real;
-begin
- Result := Timer.GetTime();
-end;
-
-(**
- * Resets the timer and state of the lyrics.
- * The timer will be stopped afterwards so you have to call Resume()
- * to start the lyrics timer.
- *)
-procedure TLyricsState.Reset();
-begin
- Pause();
- SetCurrentTime(0);
-
- StartTime := 0;
- TotalTime := 0;
-
- OldBeat := -1;
- MidBeat := -1;
- CurrentBeat := -1;
-
- OldBeatC := -1;
- MidBeatC := -1;
- CurrentBeatC := -1;
-
- OldBeatD := -1;
- MidBeatD := -1;
- CurrentBeatD := -1;
-end;
-
-(**
- * Updates the beat information (CurrentBeat/MidBeat/...) according to the
- * current lyric time.
- *)
-procedure TLyricsState.UpdateBeats();
-var
- CurLyricsTime: real;
-begin
- CurLyricsTime := GetCurrentTime();
-
- OldBeat := CurrentBeat;
- MidBeat := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeat := Floor(MidBeat);
-
- OldBeatC := CurrentBeatC;
- MidBeatC := GetMidBeat(CurLyricsTime - StartTime / 1000);
- CurrentBeatC := Floor(MidBeatC);
-
- OldBeatD := CurrentBeatD;
- // MidBeatD = MidBeat with additional GAP
- MidBeatD := -0.5 + GetMidBeat(CurLyricsTime - (StartTime + 120 + 20) / 1000);
- CurrentBeatD := Floor(MidBeatD);
-end;
-
-
{ TAudioConverter }
function TAudioConverter.Init(SrcFormatInfo: TAudioFormatInfo; DstFormatInfo: TAudioFormatInfo): boolean;
diff --git a/cmake/src/base/USingScores.pas b/cmake/src/base/USingScores.pas
index 2d9b1e5e..89896d2d 100644
--- a/cmake/src/base/USingScores.pas
+++ b/cmake/src/base/USingScores.pas
@@ -34,211 +34,211 @@ interface
{$I switches.inc}
uses
- UThemes,
gl,
+ UThemes,
UTexture;
//////////////////////////////////////////////////////////////
// ATTENTION: //
-// Enabled Flag does not Work atm. This should cause Popups //
-// Not to Move and Scores to stay until Renenabling. //
-// To use e.g. in Pause Mode //
-// Also InVisible Flag causes Attributes not to change. //
-// This should be fixed after next Draw when Visible = True,//
-// but not testet yet //
+// Enabled flag does not work atm. This should cause popups //
+// not to move and scores to stay until re-enabling. //
+// To use e.g. in pause mode //
+// also invisible flag causes attributes not to change. //
+// This should be fixed after next draw when visible = true,//
+// but not tested yet //
//////////////////////////////////////////////////////////////
-//Some constants containing options that could change by time
+// some constants containing options that could change by time
const
- MaxPlayers = 6; //Maximum of Players that could be added
- MaxPositions = 6; //Maximum of Score Positions that could be added
+ MaxPlayers = 6; // maximum of players that could be added
+ MaxPositions = 6; // maximum of score positions that could be added
type
//-----------
- // TScorePlayer - Record Containing Information about a Players Score
+ // TScorePlayer - record containing information about a players score
//-----------
TScorePlayer = record
- Position: Byte; //Index of the Position where the Player should be Drawn
- Enabled: Boolean; //Is the Score Display Enabled
- Visible: Boolean; //Is the Score Display Visible
- Score: Word; //Current Score of the Player
- ScoreDisplayed: Word; //Score cur. Displayed(for counting up)
- ScoreBG: TTexture;//Texture of the Players Scores BG
- Color: TRGB; //Teh Players Color
- RBPos: Real; //Cur. Percentille of the Rating Bar
- RBTarget: Real; //Target Position of Rating Bar
- RBVisible:Boolean; //Is Rating bar Drawn
+ Position: byte; // index of the position where the player should be drawn
+ Enabled: boolean; // is the score display enabled
+ Visible: boolean; // is the score display visible
+ Score: word; // current score of the player
+ ScoreDisplayed: word; // score cur. displayed (for counting up)
+ ScoreBG: TTexture; // texture of the players scores bg
+ Color: TRGB; // the players color
+ RBPos: real; // cur. percentille of the rating bar
+ RBTarget: real; // target position of rating bar
+ RBVisible: boolean; // is rating bar drawn
end;
- aScorePlayer = array[0..MaxPlayers-1] of TScorePlayer;
+ aScorePlayer = array [0..MaxPlayers-1] of TScorePlayer;
//-----------
- // TScorePosition - Record Containing Information about a Score Position, that can be used
+ // TScorePosition - record containing information about a score position, that can be used
//-----------
PScorePosition = ^TScorePosition;
TScorePosition = record
- //The Position is Used for Which Playercount
- PlayerCount: Byte;
- // 1 - One Player per Screen
- // 2 - 2 Players per Screen
- // 4 - 3 Players per Screen
- // 6 would be 2 and 3 Players per Screen
-
- BGX: Real; //X Position of the Score BG
- BGY: Real; //Y Position of the Score BG
- BGW: Real; //Width of the Score BG
- BGH: Real; //Height of the Score BG
-
- RBX: Real; //X Position of the Rating Bar
- RBY: Real; //Y Position of the Rating Bar
- RBW: Real; //Width of the Rating Bar
- RBH: Real; //Height of the Rating Bar
-
- TextX: Real; //X Position of the Score Text
- TextY: Real; //Y Position of the Score Text
- TextFont: Byte; //Font of the Score Text
- TextSize: integer; //Size of the Score Text
-
- PUW: Real; //Width of the LineBonus Popup
- PUH: Real; //Height of the LineBonus Popup
- PUFont: Byte; //Font for the PopUps
- PUFontSize: integer; //FontSize for the PopUps
- PUStartX: Real; //X Start Position of the LineBonus Popup
- PUStartY: Real; //Y Start Position of the LineBonus Popup
- PUTargetX: Real; //X Target Position of the LineBonus Popup
- PUTargetY: Real; //Y Target Position of the LineBonus Popup
+ // the position is used for which playercount
+ PlayerCount: byte;
+ // 1 - 1 player per screen
+ // 2 - 2 players per screen
+ // 4 - 3 players per screen
+ // 6 would be 2 and 3 players per screen
+
+ BGX: real; // x position of the score bg
+ BGY: real; // y position of the score bg
+ BGW: real; // width of the score bg
+ BGH: real; // height of the score bg
+
+ RBX: real; // x position of the rating bar
+ RBY: real; // y position of the rating bar
+ RBW: real; // width of the rating bar
+ RBH: real; // height of the rating bar
+
+ TextX: real; // x position of the score text
+ TextY: real; // y position of the score text
+ TextFont: byte; // font of the score text
+ TextSize: integer; // size of the score text
+
+ PUW: real; // width of the line bonus popup
+ PUH: real; // height of the line bonus popup
+ PUFont: byte; // font for the popups
+ PUFontSize: integer; // font size for the popups
+ PUStartX: real; // x start position of the line bonus popup
+ PUStartY: real; // y start position of the line bonus popup
+ PUTargetX: real; // x target position of the line bonus popup
+ PUTargetY: real; // y target position of the line bonus popup
end;
- aScorePosition = array[0..MaxPositions-1] of TScorePosition;
+ aScorePosition = array [0..MaxPositions-1] of TScorePosition;
//-----------
- // TScorePopUp - Record Containing Information about a LineBonus Popup
- // List, Next Item is Saved in Next attribute
+ // TScorePopUp - record containing information about a line bonus popup
+ // list, next item is saved in next attribute
//-----------
PScorePopUp = ^TScorePopUp;
TScorePopUp = record
- Player: Byte; //Index of the PopUps Player
- TimeStamp: Cardinal; //Timestamp of Popups Spawn
- Rating: Byte; //0 to 8, Type of Rating (Cool, bad, etc.)
- ScoreGiven:Word; //Score that has already been given to the Player
- ScoreDiff: Word; //Difference Between Cur Score at Spawn and Old Score
- Next: PScorePopUp; //Next Item in List
+ Player: byte; // index of the popups player
+ TimeStamp: cardinal; // timestamp of popups spawn
+ Rating: byte; // 0 to 8, type of rating (cool, bad, etc.)
+ ScoreGiven: word; // score that has already been given to the player
+ ScoreDiff: word; // difference between cur score at spawn and old score
+ Next: PScorePopUp; // next item in list
end;
aScorePopUp = array of TScorePopUp;
//-----------
- // TSingScores - Class containing Scores Positions and Drawing Scores, Rating Bar + Popups
+ // TSingScores - class containing scores positions and drawing scores, rating bar + popups
//-----------
TSingScores = class
private
Positions: aScorePosition;
- aPlayers: aScorePlayer;
- oPositionCount: Byte;
- oPlayerCount: Byte;
+ aPlayers: aScorePlayer;
+ oPositionCount: byte;
+ oPlayerCount: byte;
- //Saves the First and Last Popup of the List
+ // saves the first and last popup of the list
FirstPopUp: PScorePopUp;
LastPopUp: PScorePopUp;
- // Draws a Popup by Pointer
+ // draws a popup by pointer
procedure DrawPopUp(const PopUp: PScorePopUp);
- // Draws a Score by Playerindex
- procedure DrawScore(const Index: Integer);
+ // draws a score by playerindex
+ procedure DrawScore(const Index: integer);
- // Draws the RatingBar by Playerindex
- procedure DrawRatingBar(const Index: Integer);
+ // draws the rating bar by playerindex
+ procedure DrawRatingBar(const Index: integer);
- // Removes a PopUp w/o destroying the List
+ // removes a popup w/o destroying the list
procedure KillPopUp(const last, cur: PScorePopUp);
public
- Settings: record //Record containing some Displaying Options
- Phase1Time: Real; //time for Phase 1 to complete (in msecs)
- //The Plop Up of the PopUp
- Phase2Time: Real; //time for Phase 2 to complete (in msecs)
- //The Moving (mainly Upwards) of the Popup
- Phase3Time: Real; //time for Phase 3 to complete (in msecs)
- //The Fade out and Score adding
+ Settings: record // Record containing some Displaying Options
+ Phase1Time: real; // time for phase 1 to complete (in msecs)
+ // the plop up of the popup
+ Phase2Time: real; // time for phase 2 to complete (in msecs)
+ // the moving (mainly upwards) of the popup
+ Phase3Time: real; // time for phase 3 to complete (in msecs)
+ // the fade out and score adding
- PopUpTex: array [0..8] of TTexture; //Textures for every Popup Rating
+ PopUpTex: array [0..8] of TTexture; // textures for every popup rating
- RatingBar_BG_Tex: TTexture; //Rating Bar Texs
- RatingBar_FG_Tex: TTexture;
- RatingBar_Bar_Tex: TTexture;
+ RatingBar_BG_Tex: TTexture; // rating bar texs
+ RatingBar_FG_Tex: TTexture;
+ RatingBar_Bar_Tex: TTexture;
end;
- Visible: Boolean; //Visibility of all Scores
- Enabled: Boolean; //Scores are changed, PopUps are Moved etc.
- RBVisible: Boolean; //Visibility of all Rating Bars
+ Visible: boolean; // visibility of all scores
+ Enabled: boolean; // scores are changed, popups are moved etc.
+ RBVisible: boolean; // visibility of all rating bars
- //Propertys for Reading Position and Playercount
- property PositionCount: Byte read oPositionCount;
- property PlayerCount: Byte read oPlayerCount;
- property Players: aScorePlayer read aPlayers;
+ // properties for reading position and playercount
+ property PositionCount: byte read oPositionCount;
+ property PlayerCount: byte read oPlayerCount;
+ property Players: aScorePlayer read aPlayers;
- //Constructor just sets some standard Settings
+ // constructor just sets some standard settings
constructor Create;
- // Adds a Position to Array and Increases Position Count
+ // adds a position to array and increases position count
procedure AddPosition(const pPosition: PScorePosition);
- // Adds a Player to Array and Increases Player Count
- procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word = 0; const Enabled: Boolean = True; const Visible: Boolean = True);
+ // adds a player to array and increases player count
+ procedure AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word = 0; const Enabled: boolean = true; const Visible: boolean = true);
- //Change a Players Visibility, Enable
- procedure ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean);
- procedure ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean);
+ // change a players visibility, enable
+ procedure ChangePlayerVisibility(const Index: byte; const pVisible: boolean);
+ procedure ChangePlayerEnabled(const Index: byte; const pEnabled: boolean);
- // Deletes all Player Information
+ // deletes all player information
procedure ClearPlayers;
- // Deletes Positions and Playerinformation
+ // deletes positions and playerinformation
procedure Clear;
- // Loads some Settings and the Positions from Theme
+ // loads some settings and the positions from theme
procedure LoadfromTheme;
- // has to be called after Positions and Players have been added, before first call of Draw
- //It gives every Player a Score Position
+ // has to be called after positions and players have been added, before first call of draw
+ // it gives every player a score position
procedure Init;
- //Spawns a new Line Bonus PopUp for the Player
- procedure SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word);
+ // spawns a new line bonus popup for the player
+ procedure SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
- //Removes all PopUps from Mem
+ // removes all popups from mem
procedure KillAllPopUps;
- // Draws Scores and Linebonus PopUps
+ // draws scores and line bonus popups
procedure Draw;
end;
-
implementation
-uses SDL,
- SysUtils,
- ULog,
- UGraphic,
- TextGL;
+uses
+ SysUtils,
+ SDL,
+ TextGL,
+ ULog,
+ UGraphic;
{**
- * Sets some standard Settings
+ * sets some standard settings
*}
-Constructor TSingScores.Create;
+constructor TSingScores.Create;
begin
inherited;
- //Clear PopupList Pointers
+ // clear popuplist pointers
FirstPopUp := nil;
LastPopUp := nil;
- //Clear Variables
- Visible := True;
- Enabled := True;
- RBVisible := True;
+ // clear variables
+ Visible := true;
+ Enabled := true;
+ RBVisible := true;
- //Clear Position Index
- oPositionCount := 0;
- oPlayerCount := 0;
+ // clear position index
+ oPositionCount := 0;
+ oPlayerCount := 0;
Settings.Phase1Time := 350; // plop it up . -> [ ]
Settings.Phase2Time := 550; // shift it up ^[ ]^
@@ -260,22 +260,21 @@ begin
end;
{**
- * Adds a Position to Array and Increases Position Count
+ * adds a position to array and increases position count
*}
-Procedure TSingScores.AddPosition(const pPosition: PScorePosition);
+procedure TSingScores.AddPosition(const pPosition: PScorePosition);
begin
if (PositionCount < MaxPositions) then
begin
Positions[PositionCount] := pPosition^;
-
Inc(oPositionCount);
end;
end;
{**
- * Adds a Player to Array and Increases Player Count
+ * adds a player to array and increases player count
*}
-Procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: Word; const Enabled: Boolean; const Visible: Boolean);
+procedure TSingScores.AddPlayer(const ScoreBG: TTexture; const Color: TRGB; const Score: word; const Enabled: boolean; const Visible: boolean);
begin
if (PlayerCount < MaxPlayers) then
begin
@@ -283,48 +282,48 @@ begin
aPlayers[PlayerCount].Enabled := Enabled;
aPlayers[PlayerCount].Visible := Visible;
aPlayers[PlayerCount].Score := Score;
- aPlayers[PlayerCount].ScoreDisplayed := Score;
+ aPlayers[PlayerCount].ScoreDisplayed := Score;
aPlayers[PlayerCount].ScoreBG := ScoreBG;
aPlayers[PlayerCount].Color := Color;
aPlayers[PlayerCount].RBPos := 0.5;
aPlayers[PlayerCount].RBTarget := 0.5;
- aPlayers[PlayerCount].RBVisible := True;
+ aPlayers[PlayerCount].RBVisible := true;
Inc(oPlayerCount);
end;
end;
{**
- * Change a Players Visibility
+ * change a players visibility
*}
-Procedure TSingScores.ChangePlayerVisibility(const Index: Byte; const pVisible: Boolean);
+procedure TSingScores.ChangePlayerVisibility(const Index: byte; const pVisible: boolean);
begin
if (Index < MaxPlayers) then
aPlayers[Index].Visible := pVisible;
end;
{**
- * Change Player Enabled
+ * change player enabled
*}
-Procedure TSingScores.ChangePlayerEnabled(const Index: Byte; const pEnabled: Boolean);
+procedure TSingScores.ChangePlayerEnabled(const Index: byte; const pEnabled: boolean);
begin
if (Index < MaxPlayers) then
aPlayers[Index].Enabled := pEnabled;
end;
{**
- * Procedure Deletes all Player Information
+ * procedure deletes all player information
*}
-Procedure TSingScores.ClearPlayers;
+procedure TSingScores.ClearPlayers;
begin
KillAllPopUps;
oPlayerCount := 0;
end;
{**
- * Procedure Deletes Positions and Playerinformation
+ * procedure deletes positions and playerinformation
*}
-Procedure TSingScores.Clear;
+procedure TSingScores.Clear;
begin
KillAllPopUps;
oPlayerCount := 0;
@@ -332,14 +331,16 @@ begin
end;
{**
- * Procedure Loads some Settings and the Positions from Theme
+ * procedure loads some settings and the positions from theme
*}
-Procedure TSingScores.LoadfromTheme;
-var I: Integer;
- Procedure AddbyStatics(const PC: Byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText);
- var nPosition: TScorePosition;
+procedure TSingScores.LoadfromTheme;
+var
+ I: integer;
+ procedure AddbyStatics(const PC: byte; const ScoreStatic, SingBarStatic: TThemeStatic; ScoreText: TThemeText);
+ var
+ nPosition: TScorePosition;
begin
- nPosition.PlayerCount := PC; //Only for one Player Playing
+ nPosition.PlayerCount := PC; // only for one player playing
nPosition.BGX := ScoreStatic.X;
nPosition.BGY := ScoreStatic.Y;
@@ -373,54 +374,55 @@ var I: Integer;
begin
Clear;
- //Set Textures
- //Popup Tex
- For I := 0 to 8 do
+ // set textures
+ // popup tex
+ for I := 0 to 8 do
Settings.PopUpTex[I] := Tex_SingLineBonusBack[I];
- //Rating Bar Tex
+ // rating bar tex
Settings.RatingBar_BG_Tex := Tex_SingBar_Back;
Settings.RatingBar_FG_Tex := Tex_SingBar_Front;
Settings.RatingBar_Bar_Tex := Tex_SingBar_Bar;
- //Load Positions from Theme
+ // load positions from theme
- // Player1:
+ // player 1:
AddByStatics(1, Theme.Sing.StaticP1ScoreBG, Theme.Sing.StaticP1SingBar, Theme.Sing.TextP1Score);
AddByStatics(2, Theme.Sing.StaticP1TwoPScoreBG, Theme.Sing.StaticP1TwoPSingBar, Theme.Sing.TextP1TwoPScore);
AddByStatics(4, Theme.Sing.StaticP1ThreePScoreBG, Theme.Sing.StaticP1ThreePSingBar, Theme.Sing.TextP1ThreePScore);
- // Player2:
+ // player 2:
AddByStatics(2, Theme.Sing.StaticP2RScoreBG, Theme.Sing.StaticP2RSingBar, Theme.Sing.TextP2RScore);
AddByStatics(4, Theme.Sing.StaticP2MScoreBG, Theme.Sing.StaticP2MSingBar, Theme.Sing.TextP2MScore);
- // Player3:
+ // player 3:
AddByStatics(4, Theme.Sing.StaticP3RScoreBG, Theme.Sing.StaticP3SingBar, Theme.Sing.TextP3RScore);
end;
{**
- * Spawns a new Line Bonus PopUp for the Player
+ * spawns a new line bonus popup for the player
*}
-Procedure TSingScores.SpawnPopUp(const PlayerIndex: Byte; const Rating: Byte; const Score: Word);
-var Cur: PScorePopUp;
+procedure TSingScores.SpawnPopUp(const PlayerIndex: byte; const Rating: byte; const Score: word);
+var
+ Cur: PScorePopUp;
begin
if (PlayerIndex < PlayerCount) then
begin
- //Get Memory and Add Data
+ // get memory and add data
GetMem(Cur, SizeOf(TScorePopUp));
- Cur.Player := PlayerIndex;
+ Cur.Player := PlayerIndex;
Cur.TimeStamp := SDL_GetTicks;
- //limit rating value to 8
- //a higher value would cause a crash when selecting the bg textur
+ // limit rating value to 8
+ // a higher value would cause a crash when selecting the bg texture
if (Rating > 8) then
Cur.Rating := 8
else
Cur.Rating := Rating;
Cur.ScoreGiven:= 0;
- If (Players[PlayerIndex].Score < Score) then
+ if (Players[PlayerIndex].Score < Score) then
begin
Cur.ScoreDiff := Score - Players[PlayerIndex].Score;
aPlayers[PlayerIndex].Score := Score;
@@ -429,77 +431,77 @@ begin
Cur.ScoreDiff := 0;
Cur.Next := nil;
- //Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff));
+ // Log.LogError('TSingScores.SpawnPopUp| Player: ' + InttoStr(PlayerIndex) + ', Score: ' + InttoStr(Score) + ', ScoreDiff: ' + InttoStr(Cur.ScoreDiff));
- //Add it to the Chain
+ // add it to the chain
if (FirstPopUp = nil) then
- //the first PopUp in the List
+ // the first popup in the list
FirstPopUp := Cur
else
- //second or earlier popup
+ // second or earlier popup
LastPopUp.Next := Cur;
- //Set new Popup to Last PopUp in the List
+ // set new popup to last popup in the list
LastPopUp := Cur;
end
else
- Log.LogError('TSingScores: Try to add PopUp for not existing player');
+ Log.LogError('TSingScores: Try to add popup for non-existing player');
end;
{**
- * Removes a PopUp w/o destroying the List
+ * removes a popup w/o destroying the list
*}
-Procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
+procedure TSingScores.KillPopUp(const last, cur: PScorePopUp);
begin
- //Give Player the Last Points that missing till now
+ // give player the last points that missing till now
aPlayers[Cur.Player].ScoreDisplayed := aPlayers[Cur.Player].ScoreDisplayed + Cur.ScoreDiff - Cur.ScoreGiven;
- //Change Bars Position
+ // change bars position
if (Cur.ScoreDiff > 0) THEN
- begin //Popup w/ scorechange -> give missing Percentille
+ begin // popup w/ scorechange -> give missing percentille
aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
(Cur.ScoreDiff - Cur.ScoreGiven) / Cur.ScoreDiff
* (Cur.Rating / 20 - 0.26);
end
else
- begin //Popup w/o scorechange -> give complete Percentille
+ begin // popup w/o scorechange -> give complete percentille
aPlayers[Cur.Player].RBTarget := aPlayers[Cur.Player].RBTarget +
(Cur.Rating / 20 - 0.26);
end;
- If (aPlayers[Cur.Player].RBTarget > 1) then
+ if (aPlayers[Cur.Player].RBTarget > 1) then
aPlayers[Cur.Player].RBTarget := 1
else
- If (aPlayers[Cur.Player].RBTarget < 0) then
+ if (aPlayers[Cur.Player].RBTarget < 0) then
aPlayers[Cur.Player].RBTarget := 0;
- //If this is the First PopUp => Make Next PopUp the First
- If (Cur = FirstPopUp) then
+ // if this is the first popup => make next popup the first
+ if (Cur = FirstPopUp) then
FirstPopUp := Cur.Next
- //Else => Remove Curent Popup from Chain
+ // else => remove curent popup from chain
else
Last.Next := Cur.Next;
- //If this is the Last PopUp, Make PopUp before the Last
- If (Cur = LastPopUp) then
+ // if this is the last popup, make popup before the last
+ if (Cur = LastPopUp) then
LastPopUp := Last;
- //Free the Memory
+ // free the memory
FreeMem(Cur, SizeOf(TScorePopUp));
end;
{**
- * Removes all PopUps from Mem
+ * removes all popups from mem
*}
-Procedure TSingScores.KillAllPopUps;
+procedure TSingScores.KillAllPopUps;
var
Cur: PScorePopUp;
Last: PScorePopUp;
begin
Cur := FirstPopUp;
- //Remove all PopUps:
- While (Cur <> nil) do
+ // remove all popups:
+ while (Cur <> nil) do
begin
Last := Cur;
Cur := Cur.Next;
@@ -511,40 +513,42 @@ begin
end;
{**
- * Has to be called after Positions and Players have been added, before first call of Draw
- * It gives every Player a Score Position
+ * has to be called after positions and players have been added, before first call of draw
+ * it gives each player a score position
*}
-Procedure TSingScores.Init;
+procedure TSingScores.Init;
var
- PlC: Array [0..1] of Byte; //Playercount First Screen and Second Screen
- I, J: Integer;
- MaxPlayersperScreen: Byte;
- CurPlayer: Byte;
-
- Function GetPositionCountbyPlayerCount(bPlayerCount: Byte): Byte;
- var I: Integer;
+ PlC: array [0..1] of byte; // playercount first screen and second screen
+ I, J: integer;
+ MaxPlayersperScreen: byte;
+ CurPlayer: byte;
+
+ function GetPositionCountbyPlayerCount(bPlayerCount: byte): byte;
+ var
+ I: integer;
begin
Result := 0;
bPlayerCount := 1 shl (bPlayerCount - 1);
- For I := 0 to PositionCount-1 do
+ for I := 0 to PositionCount - 1 do
begin
- If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then
+ if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then
Inc(Result);
end;
end;
- Function GetPositionbyPlayernum(bPlayerCount, bPlayer: Byte): Byte;
- var I: Integer;
+ function GetPositionbyPlayernum(bPlayerCount, bPlayer: byte): byte;
+ var
+ I: integer;
begin
bPlayerCount := 1 shl (bPlayerCount - 1);
- Result := High(Byte);
+ Result := High(byte);
- For I := 0 to PositionCount-1 do
+ for I := 0 to PositionCount - 1 do
begin
- If ((Positions[I].PlayerCount AND bPlayerCount) <> 0) then
+ if ((Positions[I].PlayerCount and bPlayerCount) <> 0) then
begin
- If (bPlayer = 0) then
+ if (bPlayer = 0) then
begin
Result := I;
Break;
@@ -558,17 +562,16 @@ var
begin
MaxPlayersPerScreen := 0;
- For I := 1 to 6 do
+ for I := 1 to 6 do
begin
- //If there are enough Positions -> Write to MaxPlayers
- If (GetPositionCountbyPlayerCount(I) = I) then
+ // if there are enough positions -> write to maxplayers
+ if (GetPositionCountbyPlayerCount(I) = I) then
MaxPlayersPerScreen := I
else
Break;
end;
-
- //Split Players to both Screen or Display on One Screen
+ // split players to both screens or display on one screen
if (Screens = 2) and (MaxPlayersPerScreen < PlayerCount) then
begin
PlC[0] := PlayerCount div 2 + PlayerCount mod 2;
@@ -580,9 +583,8 @@ begin
PlC[1] := 0;
end;
-
- //Check if there are enough Positions for all Players
- For I := 0 to Screens - 1 do
+ // check if there are enough positions for all players
+ for I := 0 to Screens - 1 do
begin
if (PlC[I] > MaxPlayersperScreen) then
begin
@@ -592,34 +594,34 @@ begin
end;
CurPlayer := 0;
- //Give every Player a Position
- For I := 0 to Screens - 1 do
- For J := 0 to PlC[I]-1 do
+ // give every player a position
+ for I := 0 to Screens - 1 do
+ for J := 0 to PlC[I]-1 do
begin
- aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) OR (I shl 7);
- //Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position));
+ aPlayers[CurPlayer].Position := GetPositionbyPlayernum(PlC[I], J) or (I shl 7);
+ // Log.LogError('Player ' + InttoStr(CurPlayer) + ' gets Position: ' + InttoStr(aPlayers[CurPlayer].Position));
Inc(CurPlayer);
end;
end;
{**
- * Draws Scores and Linebonus PopUps
+ * draws scores and linebonus popups
*}
-Procedure TSingScores.Draw;
+procedure TSingScores.Draw;
var
- I: Integer;
- CurTime: Cardinal;
+ I: integer;
+ CurTime: cardinal;
CurPopUp, LastPopUp: PScorePopUp;
begin
CurTime := SDL_GetTicks;
- If Visible then
+ if Visible then
begin
- //Draw Popups
+ // draw popups
LastPopUp := nil;
CurPopUp := FirstPopUp;
- While (CurPopUp <> nil) do
+ while (CurPopUp <> nil) do
begin
if (CurTime - CurPopUp.TimeStamp > Settings.Phase1Time + Settings.Phase2Time + Settings.Phase3Time) then
begin
@@ -638,64 +640,64 @@ begin
end;
- IF (RBVisible) then
- //Draw Players w/ Rating Bar
- For I := 0 to PlayerCount-1 do
+ if (RBVisible) then
+ // draw players w/ rating bar
+ for I := 0 to PlayerCount-1 do
begin
DrawScore(I);
DrawRatingBar(I);
end
else
- //Draw Players w/o Rating Bar
- For I := 0 to PlayerCount-1 do
+ // draw players w/o rating bar
+ for I := 0 to PlayerCount-1 do
begin
DrawScore(I);
end;
- end; //eo Visible
+ end; // eo visible
end;
{**
- * Draws a Popup by Pointer
+ * draws a popup by pointer
*}
-Procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp);
+procedure TSingScores.DrawPopUp(const PopUp: PScorePopUp);
var
- Progress: Real;
- CurTime: Cardinal;
- X, Y, W, H, Alpha: Real;
- FontSize: integer;
- FontOffset: Real;
- TimeDiff: Cardinal;
- PIndex: Byte;
- TextLen: Real;
- ScoretoAdd: Word;
- PosDiff: Real;
+ Progress: real;
+ CurTime: cardinal;
+ X, Y, W, H, Alpha: real;
+ FontSize: integer;
+ FontOffset: real;
+ TimeDiff: cardinal;
+ PIndex: byte;
+ TextLen: real;
+ ScoretoAdd: word;
+ PosDiff: real;
begin
if (PopUp <> nil) then
begin
- //Only Draw if Player has a Position
+ // only draw if player has a position
PIndex := Players[PopUp.Player].Position;
- If PIndex <> high(byte) then
+ if PIndex <> High(byte) then
begin
- //Only Draw if Player is on Cur Screen
- If ((Players[PopUp.Player].Position AND 128) = 0) = (ScreenAct = 1) then
+ // only draw if player is on cur screen
+ if ((Players[PopUp.Player].Position and 128) = 0) = (ScreenAct = 1) then
begin
CurTime := SDL_GetTicks;
- If Not (Enabled AND Players[PopUp.Player].Enabled) then
- //Increase Timestamp with TIem where there is no Movement ...
+ if not (Enabled and Players[PopUp.Player].Enabled) then
+ // increase timestamp with tiem where there is no movement ...
begin
- //Inc(PopUp.TimeStamp, LastRender);
+ // Inc(PopUp.TimeStamp, LastRender);
end;
TimeDiff := CurTime - PopUp.TimeStamp;
- //Get Position of PopUp
- PIndex := PIndex AND 127;
+ // get position of popup
+ PIndex := PIndex and 127;
- //Check for Phase ...
- If (TimeDiff <= Settings.Phase1Time) then
+ // check for phase ...
+ if (TimeDiff <= Settings.Phase1Time) then
begin
- //Phase 1 - The Ploping up
+ // phase 1 - the ploping up
Progress := TimeDiff / Settings.Phase1Time;
@@ -706,25 +708,25 @@ begin
Y := Positions[PIndex].PUStartY + (Positions[PIndex].PUH - H)/2;
FontSize := Round(Progress * Positions[PIndex].PUFontSize);
- FontOffset := (H - FontSize) / 2;
+ FontOffset := (H - FontSize) / 2;
Alpha := 1;
end
- Else If (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then
+ else if (TimeDiff <= Settings.Phase2Time + Settings.Phase1Time) then
begin
- //Phase 2 - The Moving
+ // phase 2 - the moving
Progress := (TimeDiff - Settings.Phase1Time) / Settings.Phase2Time;
W := Positions[PIndex].PUW;
H := Positions[PIndex].PUH;
PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX;
- If PosDiff > 0 then
+ if PosDiff > 0 then
PosDiff := PosDiff + W;
X := Positions[PIndex].PUStartX + PosDiff * sqr(Progress);
PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY;
- If PosDiff < 0 then
+ if PosDiff < 0 then
PosDiff := PosDiff + Positions[PIndex].BGH;
Y := Positions[PIndex].PUStartY + PosDiff * sqr(Progress);
@@ -735,65 +737,68 @@ begin
else
begin
- //Phase 3 - The Fading out + Score adding
+ // phase 3 - the fading out + score adding
Progress := (TimeDiff - Settings.Phase1Time - Settings.Phase2Time) / Settings.Phase3Time;
- If (PopUp.Rating > 0) then
+ if (PopUp.Rating > 0) then
begin
- //Add Scores if Player Enabled
- If (Enabled AND Players[PopUp.Player].Enabled) then
+ // add scores if player enabled
+ if (Enabled and Players[PopUp.Player].Enabled) then
begin
ScoreToAdd := Round(PopUp.ScoreDiff * Progress) - PopUp.ScoreGiven;
Inc(PopUp.ScoreGiven, ScoreToAdd);
aPlayers[PopUp.Player].ScoreDisplayed := Players[PopUp.Player].ScoreDisplayed + ScoreToAdd;
- //Change Bars Position
- aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26);
- If (aPlayers[PopUp.Player].RBTarget > 1) then
+ // change bar positions
+ if PopUp.ScoreDiff = 0 then
+ Log.LogError('TSingScores.DrawPopUp', 'PopUp.ScoreDiff is 0 and we want to divide by it. No idea how this happens.')
+ else
+ aPlayers[PopUp.Player].RBTarget := aPlayers[PopUp.Player].RBTarget + ScoreToAdd/PopUp.ScoreDiff * (PopUp.Rating / 20 - 0.26);
+ if (aPlayers[PopUp.Player].RBTarget > 1) then
aPlayers[PopUp.Player].RBTarget := 1
- else If (aPlayers[PopUp.Player].RBTarget < 0) then
+ else if (aPlayers[PopUp.Player].RBTarget < 0) then
aPlayers[PopUp.Player].RBTarget := 0;
end;
- //Set Positions etc.
- Alpha := 0.7 - 0.7 * Progress;
+ // set positions etc.
+ Alpha := 0.7 - 0.7 * Progress;
W := Positions[PIndex].PUW;
H := Positions[PIndex].PUH;
PosDiff := Positions[PIndex].PUTargetX - Positions[PIndex].PUStartX;
- If (PosDiff > 0) then
+ if (PosDiff > 0) then
PosDiff := W
else
PosDiff := 0;
X := Positions[PIndex].PUTargetX + PosDiff * Progress;
PosDiff := Positions[PIndex].PUTargetY - Positions[PIndex].PUStartY;
- If (PosDiff < 0) then
+ if (PosDiff < 0) then
PosDiff := -Positions[PIndex].BGH
else
PosDiff := 0;
- Y := Positions[PIndex].PUTargetY - PosDiff * (1-Progress);
+ Y := Positions[PIndex].PUTargetY - PosDiff * (1 - Progress);
FontSize := Positions[PIndex].PUFontSize;
FontOffset := (H - FontSize) / 2;
end
else
begin
- //Here the Effect that Should be shown if a PopUp without Score is Drawn
- //And or Spawn with the GraphicObjects etc.
- //Some Work for Blindy to do :P
+ // here the effect that should be shown if a popup without score is drawn
+ // and or spawn with the graphicobjects etc.
+ // some work for blindy to do :p
- //ATM: Just Let it Slide in the Scores just like the Normal PopUp
+ // atm: just let it slide in the scores just like the normal popup
Alpha := 0;
end;
end;
- //Draw PopUp
+ // draw popup
- if (Alpha > 0) AND (Players[PopUp.Player].Visible) then
+ if (Alpha > 0) and (Players[PopUp.Player].Visible) then
begin
- //Draw BG:
+ // draw bg:
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -811,45 +816,46 @@ begin
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- //Set FontStyle and Size
+ // set font style and size
SetFontStyle(Positions[PIndex].PUFont);
- SetFontItalic(False);
+ SetFontItalic(false);
SetFontSize(FontSize);
+ SetFontReflection(false, 0);
- //Draw Text
+ // draw text
TextLen := glTextWidth(Theme.Sing.LineBonusText[PopUp.Rating]);
- //Color and Pos
+ // color and pos
SetFontPos (X + (W - TextLen) / 2, Y + FontOffset);
glColor4f(1, 1, 1, Alpha);
- //Draw
+ // draw
glPrint(Theme.Sing.LineBonusText[PopUp.Rating]);
- end; //eo Alpha check
- end; //eo Right Screen
- end; //eo Player has Position
+ end; // eo alpha check
+ end; // eo right screen
+ end; // eo player has position
end
else
- Log.LogError('TSingScores: Try to Draw a not existing PopUp');
+ Log.LogError('TSingScores: Try to draw a non-existing popup');
end;
{**
- * Draws a Score by Playerindex
+ * draws a score by playerindex
*}
-Procedure TSingScores.DrawScore(const Index: Integer);
+procedure TSingScores.DrawScore(const Index: integer);
var
Position: PScorePosition;
ScoreStr: String;
begin
- //Only Draw if Player has a Position
- If Players[Index].Position <> high(byte) then
+ // only draw if player has a position
+ if Players[Index].Position <> High(byte) then
begin
- //Only Draw if Player is on Cur Screen
- If (((Players[Index].Position AND 128) = 0) = (ScreenAct = 1)) AND Players[Index].Visible then
+ // only draw if player is on cur screen
+ if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1)) and Players[Index].Visible then
begin
Position := @Positions[Players[Index].Position and 127];
- //Draw ScoreBG
+ // draw scorebg
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -867,50 +873,51 @@ begin
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- //Draw Score Text
+ // draw score text
SetFontStyle(Position.TextFont);
- SetFontItalic(False);
+ SetFontItalic(false);
SetFontSize(Position.TextSize);
SetFontPos(Position.TextX, Position.TextY);
+ SetFontReflection(false, 0);
ScoreStr := InttoStr(Players[Index].ScoreDisplayed div 10) + '0';
- While (Length(ScoreStr) < 5) do
+ while (Length(ScoreStr) < 5) do
ScoreStr := '0' + ScoreStr;
glPrint(ScoreStr);
- end; //eo Right Screen
- end; //eo Player has Position
+ end; // eo right screen
+ end; // eo player has position
end;
-Procedure TSingScores.DrawRatingBar(const Index: Integer);
+procedure TSingScores.DrawRatingBar(const Index: integer);
var
- Position: PScorePosition;
- R,G,B, Size: Real;
- Diff: Real;
+ Position: PScorePosition;
+ R, G, B: real;
+ Size, Diff: real;
begin
- //Only Draw if Player has a Position
- if Players[Index].Position <> high(byte) then
+ // only draw if player has a position
+ if Players[Index].Position <> High(byte) then
begin
- //Only Draw if Player is on Cur Screen
+ // only draw if player is on cur screen
if (((Players[Index].Position and 128) = 0) = (ScreenAct = 1) and
Players[index].RBVisible and
Players[index].Visible) then
begin
Position := @Positions[Players[Index].Position and 127];
- if (Enabled AND Players[Index].Enabled) then
+ if (Enabled and Players[Index].Enabled) then
begin
- //Move Position if Enabled
+ // move position if enabled
Diff := Players[Index].RBTarget - Players[Index].RBPos;
- If(Abs(Diff) < 0.02) then
+ if (Abs(Diff) < 0.02) then
aPlayers[Index].RBPos := aPlayers[Index].RBTarget
else
aPlayers[Index].RBPos := aPlayers[Index].RBPos + Diff*0.1;
end;
- //Get Colors for RatingBar
+ // get colors for rating bar
if (Players[index].RBPos <= 0.22) then
begin
R := 1;
@@ -920,7 +927,7 @@ begin
else if (Players[index].RBPos <= 0.42) then
begin
R := 1;
- G := Players[index].RBPos*5;
+ G := Players[index].RBPos * 5;
B := 0;
end
else if (Players[index].RBPos <= 0.57) then
@@ -931,7 +938,7 @@ begin
end
else if (Players[index].RBPos <= 0.77) then
begin
- R := 1-(Players[index].RBPos-0.57)*5;
+ R := 1 - (Players[index].RBPos - 0.57) * 5;
G := 1;
B := 0;
end
@@ -942,12 +949,12 @@ begin
B := 0;
end;
- //Enable all glFuncs Needed
+ // enable all glfuncs needed
glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- //Draw RatingBar BG
+ // draw rating bar bg
glColor4f(1, 1, 1, 0.8);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_BG_Tex.TexNum);
@@ -965,7 +972,7 @@ begin
glVertex2f(Position.RBX+Position.RBW, Position.RBY);
glEnd;
- //Draw Rating bar itself
+ // draw rating bar itself
Size := Position.RBX + Position.RBW * Players[Index].RBPos;
glColor4f(R, G, B, 1);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_Bar_Tex.TexNum);
@@ -983,7 +990,7 @@ begin
glVertex2f(Size, Position.RBY);
glEnd;
- //Draw Ratingbar FG (Teh thing with the 3 lines to get better readability)
+ // draw rating bar fg (the thing with the 3 lines to get better readability)
glColor4f(1, 1, 1, 0.6);
glBindTexture(GL_TEXTURE_2D, Settings.RatingBar_FG_Tex.TexNum);
glBegin(GL_QUADS);
@@ -1000,11 +1007,11 @@ begin
glVertex2f(Position.RBX + Position.RBW, Position.RBY);
glEnd;
- //Disable all Enabled glFuncs
+ // disable all enabled glfuncs
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
- end; //eo Right Screen
- end; //eo Player has Position
+ end; // eo Right Screen
+ end; // eo Player has Position
end;
end.
diff --git a/cmake/src/base/UTexture.pas b/cmake/src/base/UTexture.pas
index 962bd2b0..97f244fe 100644
--- a/cmake/src/base/UTexture.pas
+++ b/cmake/src/base/UTexture.pas
@@ -336,8 +336,8 @@ begin
X := 0;
Y := 0;
Z := 0;
- W := 0;
- H := 0;
+ W := oldWidth;
+ H := oldHeight;
ScaleW := 1;
ScaleH := 1;
Rot := 0;
diff --git a/cmake/src/base/UThemes.pas b/cmake/src/base/UThemes.pas
index 9bf858ed..3fd77853 100644
--- a/cmake/src/base/UThemes.pas
+++ b/cmake/src/base/UThemes.pas
@@ -42,13 +42,13 @@ uses
type
TRGB = record
- R: single;
- G: single;
- B: single;
+ R: single;
+ G: single;
+ B: single;
end;
TRGBA = record
- R, G, B, A: Double;
+ R, G, B, A: double;
end;
type
@@ -175,11 +175,12 @@ type
W: integer;
H: integer;
Z: real;
+ SBGW: integer;
TextSize: integer;
- //SBGW Mod
- SBGW: integer;
+ showArrows:boolean;
+ oneItemOnly:boolean;
Text: string;
ColR, ColG, ColB, Int: real;
@@ -359,6 +360,11 @@ type
PausePopUp: TThemeStatic;
end;
+ TThemeLyricBar = record
+ IndicatorYOffset, UpperX, UpperW, UpperY, UpperH,
+ LowerX, LowerW, LowerY, LowerH : integer;
+ end;
+
TThemeScore = class(TThemeBasic)
TextArtist: TThemeText;
TextTitle: TThemeText;
@@ -723,6 +729,7 @@ type
Level: TThemeLevel;
Song: TThemeSong;
Sing: TThemeSing;
+ LyricBar: TThemeLyricBar;
Score: TThemeScore;
Top5: TThemeTop5;
Options: TThemeOptions;
@@ -1031,9 +1038,19 @@ begin
ThemeLoadStatic(Song.StaticTeam3Joker5, 'SongStaticTeam3Joker5');
+ //LyricBar asd
+ LyricBar.UpperX := ThemeIni.ReadInteger('SingLyricsUpperBar', 'X', 0);
+ LyricBar.UpperW := ThemeIni.ReadInteger('SingLyricsUpperBar', 'W', 0);
+ LyricBar.UpperY := ThemeIni.ReadInteger('SingLyricsUpperBar', 'Y', 0);
+ LyricBar.UpperH := ThemeIni.ReadInteger('SingLyricsUpperBar', 'H', 0);
+ LyricBar.IndicatorYOffset := ThemeIni.ReadInteger('SingLyricsUpperBar', 'IndicatorYOffset', 0);
+ LyricBar.LowerX := ThemeIni.ReadInteger('SingLyricsLowerBar', 'X', 0);
+ LyricBar.LowerW := ThemeIni.ReadInteger('SingLyricsLowerBar', 'W', 0);
+ LyricBar.LowerY := ThemeIni.ReadInteger('SingLyricsLowerBar', 'Y', 0);
+ LyricBar.LowerH := ThemeIni.ReadInteger('SingLyricsLowerBar', 'H', 0);
+
// Sing
ThemeLoadBasic(Sing, 'Sing');
-
//TimeBar mod
ThemeLoadStatic(Sing.StaticTimeProgress, 'SingTimeProgress');
ThemeLoadText(Sing.TextTimeText, 'SingTimeText');
@@ -1769,7 +1786,7 @@ begin
ThemeSelectS.SkipX := ThemeIni.ReadInteger(Name, 'SkipX', 0);
- ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 450);
+ ThemeSelectS.SBGW := ThemeIni.ReadInteger(Name, 'SBGW', 400);
LoadColor(ThemeSelectS.ColR, ThemeSelectS.ColG, ThemeSelectS.ColB, ThemeIni.ReadString(Name, 'Color', ''));
ThemeSelectS.Int := ThemeIni.ReadFloat(Name, 'Int', 1);
diff --git a/cmake/src/base/UTime.pas b/cmake/src/base/UTime.pas
index 3f35dffd..83844cb5 100644
--- a/cmake/src/base/UTime.pas
+++ b/cmake/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);