aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-28 19:54:31 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-04-28 19:54:31 +0000
commit60e6d3f9904a8114e985fccd14454b9b604ea275 (patch)
treec3dc298e5c81272f3df8e80171ae0f60d8774f2e /Game/Code/Classes
parent58a47541955f5010269d72a06e307bbb945211ea (diff)
downloadusdx-60e6d3f9904a8114e985fccd14454b9b604ea275.tar.gz
usdx-60e6d3f9904a8114e985fccd14454b9b604ea275.tar.xz
usdx-60e6d3f9904a8114e985fccd14454b9b604ea275.zip
- new SDL.dll (with a quick and dirty workaround for the hanging-mouse problem)
- changing of sorting and folder-option (on/off) does not need any restart now - a lot of code clean up - some bugfixes... i hope... dont't know which... git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2316 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/TextGL.pas4
-rw-r--r--Game/Code/Classes/UCovers.pas10
-rw-r--r--Game/Code/Classes/UDLLManager.pas2
-rw-r--r--Game/Code/Classes/UDataBase.pas6
-rw-r--r--Game/Code/Classes/UDraw.pas26
-rw-r--r--Game/Code/Classes/UFiles.pas6
-rw-r--r--Game/Code/Classes/UGraphic.pas111
-rw-r--r--Game/Code/Classes/UHelp.pas11
-rw-r--r--Game/Code/Classes/UIni.pas13
-rw-r--r--Game/Code/Classes/UJoystick.pas4
-rw-r--r--Game/Code/Classes/ULog.pas3
-rw-r--r--Game/Code/Classes/UMain.pas41
-rw-r--r--Game/Code/Classes/UMusic.pas28
-rw-r--r--Game/Code/Classes/UParty.pas13
-rw-r--r--Game/Code/Classes/UPartyM2.pas6
-rw-r--r--Game/Code/Classes/URecord.pas5
-rw-r--r--Game/Code/Classes/USkins.pas6
-rw-r--r--Game/Code/Classes/USongs.pas413
-rw-r--r--Game/Code/Classes/UTexture.pas9
-rw-r--r--Game/Code/Classes/UThemes.pas10
-rw-r--r--Game/Code/Classes/UVideo.pas288
21 files changed, 474 insertions, 541 deletions
diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas
index 7ebe1151..10043e3b 100644
--- a/Game/Code/Classes/TextGL.pas
+++ b/Game/Code/Classes/TextGL.pas
@@ -54,8 +54,6 @@ uses UMain, Windows, SysUtils, UGraphic;
procedure BuildFont; // Build Our Bitmap Font
var
- font: HFONT; // Windows Font ID
- h_dc: hdc;
Rejestr: TResourceStream;
Pet: integer;
begin
@@ -342,4 +340,4 @@ begin
Fonts[ActFont].AspectW := Aspect;
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UCovers.pas b/Game/Code/Classes/UCovers.pas
index b7bef8e6..c74bbaf4 100644
--- a/Game/Code/Classes/UCovers.pas
+++ b/Game/Code/Classes/UCovers.pas
@@ -48,7 +48,6 @@ end;
procedure TCovers.Load;
var
F: File;
- C: integer; // cover number
W: word;
H: word;
Bits: byte;
@@ -102,13 +101,14 @@ begin
end;
procedure TCovers.Save;
+{
var
F: File;
C: integer; // cover number
W: word;
H: word;
NLen: word;
- Bits: byte;
+ Bits: byte; }
begin
{ AssignFile(F, GamePath + 'covers.cache');
Rewrite(F, 1);
@@ -133,9 +133,9 @@ end;
procedure TCovers.AddCover(Name: string);
var
- B: integer;
+ //B: integer;
F: File;
- C: integer; // cover number
+ //C: integer; // cover number
NLen: word;
Bits: byte;
begin
@@ -223,4 +223,4 @@ begin
end;
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UDLLManager.pas b/Game/Code/Classes/UDLLManager.pas
index 4b8838b9..6ecacfc8 100644
--- a/Game/Code/Classes/UDLLManager.pas
+++ b/Game/Code/Classes/UDLLManager.pas
@@ -110,7 +110,7 @@ function TDLLMan.LoadPluginInfo(Filename: String; No: Cardinal): boolean;
var
hLibg: THandle;
Info: pModi_PluginInfo;
- I: Integer;
+ //I: Integer;
begin
Result := False;
//Clear Plugin Info
diff --git a/Game/Code/Classes/UDataBase.pas b/Game/Code/Classes/UDataBase.pas
index b9b0773a..1233dae0 100644
--- a/Game/Code/Classes/UDataBase.pas
+++ b/Game/Code/Classes/UDataBase.pas
@@ -81,8 +81,6 @@ begin
Result.P2m := 1;
P1m := 0;
P2m := 0;
- P1c := 0;
- P2c := 0;
try
P1c := ScoreDB.GetTableValue('SELECT COUNT(`SongID`) FROM `US_Scores` '+
@@ -362,7 +360,7 @@ end;
procedure TDataBaseSystem.AddScore(var Song: TSong; Level: integer; Name: string; Score: integer; TimeStamp: integer);
var
ID: Integer;
-TableData: TSqliteTable;
+//TableData: TSqliteTable;
begin
//ScoreDB := TSqliteDatabase.Create(sFilename);
try
@@ -535,4 +533,4 @@ begin
Result := ScoreDB.GetTableValue(Query);
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UDraw.pas b/Game/Code/Classes/UDraw.pas
index 441b3544..5a646cc0 100644
--- a/Game/Code/Classes/UDraw.pas
+++ b/Game/Code/Classes/UDraw.pas
@@ -227,7 +227,6 @@ var
Rec: TRecR;
Pet: integer;
TempR: real;
- R,G,B: real;
GoldenStarPos : real;
begin
@@ -317,10 +316,6 @@ var
TempR: real;
Rec: TRecR;
N: integer;
- R: real;
- G: real;
- B: real;
- A: real;
NotesH2: real;
begin
// Log.LogStatus('Player notes', 'SingDraw');
@@ -407,7 +402,7 @@ var
//if (Start+Dlugosc-1 = Czas.AktBeatD) then
if Perfect and (Ini.EffectSing=1) then begin
// A := sqrt((1+sin(Music.Position * 3))/2);
- A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc));
+ //A := 1 - 2*(Czas.Teraz - GetTimeFromBeat(Start+Dlugosc));
if not (Start+Dlugosc-1 = Czas.AktBeatD) then
//Star animation counter
@@ -467,7 +462,6 @@ var
Rec: TRecR;
Pet: integer;
TempR: real;
- R,G,B: real;
X1, X2, X3, X4: real;
W, H: real;
begin
@@ -606,7 +600,7 @@ var
Rec: TRecR;
TexRec: TRecR;
NR: TRecR;
- FS: real;
+ //FS: real;
BarFrom: integer;
BarAlpha: real;
BarWspol: real;
@@ -618,7 +612,7 @@ var
//SingBar Mod
- A: Integer;
+ A: Cardinal;
E: Integer;
I: Integer;
//end Singbar Mod
@@ -664,7 +658,7 @@ begin
ScreenSing.LyricSub.Draw;
// rysuje pasek, podpowiadajacy poczatek spiwania w scenie
- FS := 1.3;
+ //FS := 1.3;
BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start;
if BarFrom > 40 then BarFrom := 40;
if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more
@@ -998,7 +992,7 @@ var
Rec: TRecR;
TexRec: TRecR;
NR: TRecR;
- FS: real;
+ //FS: real;
BarFrom: integer;
BarAlpha: real;
BarWspol: real;
@@ -1010,7 +1004,7 @@ var
//SingBar Mod
- A: Integer;
+ A: Cardinal;
E: Integer;
I: Integer;
//end Singbar Mod
@@ -1059,7 +1053,7 @@ begin
ScreenSingModi.LyricSub.Draw;
// rysuje pasek, podpowiadajacy poczatek spiwania w scenie
- FS := 1.3;
+ //FS := 1.3;
BarFrom := Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start;
if BarFrom > 40 then BarFrom := 40;
if (Czesci[0].Czesc[Czesci[0].Akt].StartNote - Czesci[0].Czesc[Czesci[0].Akt].Start > 8) and // dluga przerwa //16->12 for more help bars and then 12->8 for even more
@@ -1477,6 +1471,9 @@ begin;
glEnd;
//SingBar coloured Bar
+ R := 1;
+ G := 0;
+ B := 0;
Case Percent of
0..22: begin
R := 1;
@@ -1717,8 +1714,6 @@ const
step = 5;
var
- txt: PChar;
- str: string;
I: integer;
num: integer;
@@ -1770,4 +1765,3 @@ begin
end;
end.
-
diff --git a/Game/Code/Classes/UFiles.pas b/Game/Code/Classes/UFiles.pas
index 854ed9b0..419a9cb8 100644
--- a/Game/Code/Classes/UFiles.pas
+++ b/Game/Code/Classes/UFiles.pas
@@ -461,7 +461,7 @@ end;
//--------------------
function AnalyseFile(var Song: TSong): boolean;
begin
-Result := False;
+//Result := False;
{try }
//Reset LineNo
FileLineNo := 0;
@@ -514,8 +514,6 @@ end;
// Parses Note Infos and save them to Array
//--------------------
procedure ParseNote(NrCzesci: integer; TypeP: char; StartP, DurationP, NoteP: integer; LyricS: string);
-var
- Space: boolean;
begin
case Ini.Solmization of
1: // european
@@ -1210,7 +1208,7 @@ begin
//set PreviewStart if not set
if Song.PreviewStart=0 then
begin
- len_notes := length(Czesci[0].Czesc[len_lines-1].Nuta);
+ //len_notes := length(Czesci[0].Czesc[len_lines-1].Nuta);
if Song.Medley.Source = msCalculated then
Song.PreviewStart := GetTimeFromBeat(Song.Medley.StartBeat);{
else
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas
index 0dae93a6..563873a5 100644
--- a/Game/Code/Classes/UGraphic.pas
+++ b/Game/Code/Classes/UGraphic.pas
@@ -2,7 +2,7 @@ unit UGraphic;
interface
uses
- SDL, gl, glext, UTexture, TextGL, ULog, SysUtils, ULyrics, UScreenLoading,
+ SDL, gl, glext, UVideo, UTexture, ULanguage, TextGL, ULog, SysUtils, ULyrics, UScreenLoading,
UScreenWelcome, UScreenMain, UScreenName, UScreenLevel, UScreenOptions, UScreenOptionsGame,
UScreenOptionsGraphics, UScreenOptionsSound, UScreenOptionsLyrics, UScreenOptionsThemes, UScreenOptionsRecord, UScreenOptionsAdvanced,
UScreenSong, UScreenSing, UScreenScore, UScreenTop, UScreenEditSub,
@@ -188,7 +188,7 @@ procedure LoadTextures;
procedure InitializeScreen;
procedure LoadScreens( aShowLoading : boolean = true );
procedure UnLoadScreens;
-
+procedure UpdateScreenLoading(txt: string);
implementation
uses UMain, UIni, UDisplay, UCommandLine, Graphics, Classes, Windows;
@@ -248,11 +248,11 @@ begin
end;
procedure Initialize3D (Title: string);
-var
- Icon: TIcon;
- Res: TResourceStream;
- ISurface: PSDL_Surface;
- Pixel: PByteArray;
+//var
+ //Icon: TIcon;
+ //Res: TResourceStream;
+ //ISurface: PSDL_Surface;
+ //Pixel: PByteArray;
begin
Log.LogStatus('LoadOpenGL', 'Initialize3D');
Log.BenchmarkStart(2);
@@ -317,7 +317,7 @@ begin
LoadScreens;
- if Log.NumErrors>0 then
+ if (Ini.LoadFaultySongs=1) and (Log.NumErrors>0) then
ScreenMain.ShowNumErrors := true;
Display.ActualScreen^.FadeTo(@ScreenMain);
@@ -331,10 +331,10 @@ end;
procedure SwapBuffers;
begin
SDL_GL_SwapBuffers;
- glMatrixMode(GL_PROJECTION);
+ {glMatrixMode(GL_PROJECTION);
glLoadIdentity;
glOrtho(0, 800, 600, 0, -1, 100);
- glMatrixMode(GL_MODELVIEW);
+ glMatrixMode(GL_MODELVIEW);}
end;
procedure Reinitialize3D;
@@ -346,22 +346,19 @@ end;
procedure InitializeScreen;
var
- S: string;
- I: integer;
- W, H: integer;
- Depth: Integer;
+ S: String;
+ I: Integer;
+ W, H: Integer;
+ Depth: Integer;
+ videoFlags: Integer;
+ videoInfo: PSDL_VideoInfo;
+
begin
if (Params.Screens <> -1) then
Screens := Params.Screens + 1
else
Screens := Ini.Screens + 1;
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-
// If there is a resolution in Parameters, use it, else use the Ini value
I := Params.Resolution;
if (I <> -1) then
@@ -373,15 +370,6 @@ begin
W := StrToInt(Copy(S, 1, I-1)) * Screens;
H := StrToInt(Copy(S, I+1, 1000));
- {if ParamStr(1) = '-fsblack' then begin
- W := 800;
- H := 600;
- end;
- if ParamStr(1) = '-320x240' then begin
- W := 320;
- H := 240;
- end; }
-
If (Params.Depth <> -1) then
Depth := Params.Depth
else
@@ -389,19 +377,59 @@ begin
Log.LogStatus('SDL_SetVideoMode', 'Initialize3D');
-// SDL_SetRefreshrate(85);
-// SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
+
+ videoInfo := SDL_GetVideoInfo;
+ if ( videoInfo = nil ) then
+ begin
+ Log.LogError('Could not get video info: ' + SDL_GetError, 'Initialize3D' );
+ Exit;
+ end;
+
+ videoFlags := SDL_OPENGL or
+ SDL_DOUBLEBUF or
+ SDL_HWPALETTE;
+
+ if ( videoInfo.hw_available <> 0 ) then
+ videoFlags := videoFlags or SDL_HWSURFACE
+ else
+ videoFlags := videoFlags or SDL_SWSURFACE;
+
+ if ( videoInfo.blit_hw <> 0 ) then videoFlags := videoFlags or SDL_HWACCEL;
+
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
+ SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+
+ SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 );
+
+ pbo_supported := false;
+ if (Ini.EnablePBO=1) then
+ begin
+ try
+ pbo_supported := glext_LoadExtension('GL_ARB_pixel_buffer_object') and
+ glext_LoadExtension('GL_version_1_5');
+ except
+ pbo_supported := false;
+ Log.LogError('The device does not support Pixel Buffer Object (UVideo)!');
+ end;
+ end;
+
if (Ini.FullScreen = 0) and (Not Params.FullScreen) then
- screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL)
+ screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, videoFlags)
else begin
- screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN or SDL_HWSURFACE);
+ screen := SDL_SetVideoMode(W, H, (Depth+1) * 16, videoFlags or SDL_FULLSCREEN);
SDL_ShowCursor(0);
end;
+
if (screen = nil) then begin
Log.LogError('SDL_SetVideoMode Failed', 'Initialize3D');
exit;
end;
+
+
// clear screen once window is being shown
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
@@ -426,7 +454,7 @@ begin
Display.Draw;
SwapBuffers;
end;
-
+
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Loading', 3); Log.BenchmarkStart(3);
{ ScreenWelcome := TScreenWelcome.Create; //'BG', 4, 3);
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Welcome', 3); Log.BenchmarkStart(3);}
@@ -436,8 +464,13 @@ begin
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Name', 3); Log.BenchmarkStart(3);
ScreenLevel := TScreenLevel.Create;
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Level', 3); Log.BenchmarkStart(3);
+
ScreenSong := TScreenSong.Create;
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song', 3); Log.BenchmarkStart(3);
+
+ if(aShowLoading) then
+ UpdateScreenLoading(Language.Translate('SING_LOADING'));
+
ScreenSongMenu := TScreenSongMenu.Create;
Log.BenchmarkEnd(3); Log.LogBenchmark('====> Screen Song Menu', 3); Log.BenchmarkStart(3);
ScreenSing := TScreenSing.Create;
@@ -565,4 +598,12 @@ begin
freeandnil( ScreenPartyPlayerM2 );
end;
-end.
+procedure UpdateScreenLoading(txt: string);
+begin
+ ScreenLoading.Text[0].Text := txt;
+ ScreenLoading.Draw;
+ //Display.Draw;
+ SwapBuffers;
+end;
+
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UHelp.pas b/Game/Code/Classes/UHelp.pas
index 4691858c..d3595e52 100644
--- a/Game/Code/Classes/UHelp.pas
+++ b/Game/Code/Classes/UHelp.pas
@@ -144,13 +144,14 @@ var
begin
SetLength(List, 0);
- if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then begin
+ if FindFirst(LanguagesPath + '*.ini', 0, SR) = 0 then
+ begin
repeat
SetLength(List, Length(List)+1);
SR.Name := ChangeFileExt(SR.Name, '');
List[High(List)].Name := SR.Name;
until FindNext(SR) <> 0;
- SysUtils.FindClose(SR);
+ SysUtils.FindClose(SR);
end; // if FindFirst
end;
@@ -310,7 +311,7 @@ end;
function THelp.SetHelpID(ID: String):boolean;
var
- E, J: integer; // entry
+ E: integer; // entry
begin
Result := false;
ScrollPos := 0.0;
@@ -357,7 +358,7 @@ end;
function THelp.GetHelpStr(): TTextResult;
var
K, I, J: Integer;
- w: real;
+
begin
SetLength(Result.Sections, Length(AEntry.Sections));
for K := 0 to Length(AEntry.Sections) - 1 do
@@ -398,4 +399,4 @@ begin
Result := ScrollPos;
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UIni.pas b/Game/Code/Classes/UIni.pas
index 048f1496..5228d870 100644
--- a/Game/Code/Classes/UIni.pas
+++ b/Game/Code/Classes/UIni.pas
@@ -40,6 +40,7 @@ type
MoviePreview: integer;
AspectCorrect: integer;
PerformanceMode:integer;
+ EnablePBO: integer;
// Sound
MicBoost: integer;
@@ -153,6 +154,7 @@ const
IMoviePreview: array[0..1] of string = ('Off', 'On');
IAspectCorrect: array[0..2] of String = ('Stretch', 'Crop', 'LetterBox');
IPerformanceMode:array[0..1] of string = ('Off', 'On');
+ IEnablePBO: array[0..1] of string = ('Off', 'On');
IMicBoost: array[0..3] of string = ('Off', '+6dB', '+12dB', '+18dB');
IClickAssist: array[0..1] of string = ('Off', 'On');
@@ -392,6 +394,11 @@ begin
for Pet := 0 to High(IPerformanceMode) do
if Tekst = IPerformanceMode[Pet] then Ini.PerformanceMode := Pet;
+ // enable Pixel Buffer Object
+ Tekst := IniFile.ReadString('Graphics', 'EnablePBO', IEnablePBO[0]);
+ for Pet := 0 to High(IEnablePBO) do
+ if Tekst = IEnablePBO[Pet] then Ini.EnablePBO := Pet;
+
// MicBoost
Tekst := IniFile.ReadString('Sound', 'MicBoost', 'Off');
for Pet := 0 to High(IMicBoost) do
@@ -729,6 +736,10 @@ begin
Tekst := IPerformanceMode[Ini.PerformanceMode];
IniFile.WriteString('Graphics', 'PerformanceMode', Tekst);
+ // enable Pixel Buffer Object
+ Tekst := IEnablePBO[Ini.EnablePBO];
+ IniFile.WriteString('Graphics', 'EnablePBO', Tekst);
+
// MicBoost
Tekst := IMicBoost[Ini.MicBoost];
IniFile.WriteString('Sound', 'MicBoost', Tekst);
@@ -867,7 +878,7 @@ end;
procedure TIni.SaveLevel;
var
IniFile: TIniFile;
- I: integer;
+
begin
//if not FileIsReadOnly(GamePath + 'config.ini') then begin
//IniFile := TIniFile.Create(GamePath + 'config.ini');
diff --git a/Game/Code/Classes/UJoystick.pas b/Game/Code/Classes/UJoystick.pas
index b0c7b8cc..cd9aadc5 100644
--- a/Game/Code/Classes/UJoystick.pas
+++ b/Game/Code/Classes/UJoystick.pas
@@ -42,7 +42,7 @@ uses SysUtils, Windows, ULog;
constructor TJoy.Create;
var
- B, N: integer;
+ B{, N}: integer;
begin
//Old Corvus5 Method
{// joystick support
@@ -99,7 +99,7 @@ begin
Log.LogError('Could not Init Joystick');
exit;
end;
- N := SDL_JoystickNumButtons(SDL_Joy);
+ //N := SDL_JoystickNumButtons(SDL_Joy);
//if N < 6 then beep;
for B := 0 to 5 do begin
diff --git a/Game/Code/Classes/ULog.pas b/Game/Code/Classes/ULog.pas
index 8104b5b5..39c334ce 100644
--- a/Game/Code/Classes/ULog.pas
+++ b/Game/Code/Classes/ULog.pas
@@ -239,13 +239,11 @@ end;
var
- FileVoice: File;
FS: TFileStream;
FileName: string;
Num: integer;
BL: integer;
Header: TWAVHeader;
- ms: TMemoryStream;
s: LongInt;
begin
@@ -309,4 +307,3 @@ end;
end.
-
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index cb70cd08..a20ba30c 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -2,7 +2,7 @@ unit UMain;
interface
uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing,
- gl, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup};
+ gl, zlportio {you can disable it and all PortWriteB calls}, UThemes{, UScreenPopup};
type
TPlayer = record
@@ -112,7 +112,7 @@ function GetTimeFromBeat(Beat: integer): real;
procedure ClearScores(PlayerNum: integer);
implementation
-uses USongs, UJoystick, math, UCommandLine;
+uses USongs, UJoystick, math, UCommandLine, UVideo;
procedure MainLoop;
var
@@ -132,12 +132,9 @@ begin
done := not Display.Draw;
SwapBuffers;
- // light
- Light.Refresh;
-
// delay
CountMidTime;
-// if 1000*TimeMid > 100 then beep;
+
Delay := Floor(1000 / 100 - 1000 * TimeMid);
if Delay >= 1 then
SDL_Delay(Delay); // dynamic, maximum is 100 fps
@@ -154,18 +151,27 @@ begin
End;
Procedure CheckEvents;
-//var
-// p: pointer;
Begin
if not Assigned(Display.NextScreen) then
While SDL_PollEvent( @event ) = 1 Do
Begin
-// beep;
Case Event.type_ Of
SDL_ACTIVEEVENT: //workaround for alt-tab bug
begin
if (Event.active.gain=1) then
+ begin
SDL_SetModState(KMOD_NONE);
+ if (Ini.FullScreen = 1) or (Params.FullScreen) then
+ SDL_ShowCursor(0);
+ EnableVideoDraw := true;
+ end;
+
+ if (Event.active.gain=0) then
+ begin
+ if (Ini.FullScreen = 1) or (Params.FullScreen) then
+ SDL_ShowCursor(1);
+ EnableVideoDraw := false;
+ end;
end;
SDL_QUITEV:
@@ -457,8 +463,6 @@ begin
else
LyricSub.Clear;
end;
-
- Sender.UpdateLCD;
//On Sentence Change...
Sender.onSentenceChange(Czesci[0].Akt);
@@ -476,12 +480,6 @@ begin
// operates on currently beated note
Sender.LyricMain.Selected := Pet;
-// LCD.MoveCursor(1, ScreenSing.LyricMain.SelectedLetter);
-// LCD.ShowCursor;
-
- LCD.MoveCursorBR(Sender.LyricMain.SelectedLetter);
- LCD.ShowCursor;
-
end;
end;
@@ -503,10 +501,6 @@ begin
//LPT_1 := 0;
// Light.LightOne(0, 150);
- Light.LightOne(1, 200); // beat light
- if ParamStr(1) = '-doublelights' then
- Light.LightOne(0, 200); // beat light
-
{ if ((Czas.AktBeatC + Czesci[0].Resolution + Czesci[0].NotesGAP) mod (Czesci[0].Resolution * 2) = 0) then
Light.LightOne(0, 150)
@@ -520,10 +514,6 @@ begin
if Ini.ClickAssist = 1 then
Music.PlayClick;
- //LPT_2 := 0;
- if ParamStr(1) <> '-doublelights' then
- Light.LightOne(0, 150); //125
-
// drum machine
(* TempBeat := Czas.AktBeat;// + 2;
@@ -743,4 +733,3 @@ begin
end;
end.
-
diff --git a/Game/Code/Classes/UMusic.pas b/Game/Code/Classes/UMusic.pas
index fae0ffd2..1e608c68 100644
--- a/Game/Code/Classes/UMusic.pas
+++ b/Game/Code/Classes/UMusic.pas
@@ -232,8 +232,8 @@ uses UGraphic, URecord, UFiles, UIni, UMain, UThemes, UTime;
//from http://www.un4seen.com/forum/?topic=5943.0;hl=sbvocalcut16
procedure SBVocalCut16(handle: DWORD; channel: DWORD; buffer: Pointer; length: DWORD; user: DWORD); stdcall;
var
- i, k: DWORD;
- dmch: Smallint;
+ i: DWORD;
+ dmch: Smallint;
lch, rch: PSmallint;
begin
@@ -305,15 +305,12 @@ begin
end;
procedure TMusic.InitializePlayback;
-var
- Pet: integer;
- S: integer;
begin
Log.BenchmarkStart(4);
Log.LogStatus('Initializing Playback Subsystem', 'Music Initialize');
Loaded := false;
Loop := false;
- fHWND := AllocateHWND( nil);
+ fHWND := Classes.AllocateHWND( nil);
if BASS_Init(1, 44100, 0, fHWND, nil) = false then
begin
@@ -367,14 +364,7 @@ end;
procedure TMusic.InitializeRecord;
var
S: integer;
- device: integer;
- descr: string;
- input: integer;
- input2: integer;
- flags: integer;
- mic: array[0..15] of integer;
- SC: integer; // soundcard
- SCI: integer; // soundcard input
+
begin
if RecordSystem = 1 then begin
SetLength(Sound, 6 {max players});//Ini.Players+1);
@@ -566,7 +556,7 @@ function TMusic.Length: real;
var
bytes: integer;
begin
- Result := 60;
+ //Result := 60;
bytes := BASS_ChannelGetLength( Bass );
Result := BASS_ChannelBytes2Seconds(Bass, bytes);
@@ -582,7 +572,7 @@ function TMusic.Position: real;
var
bytes: integer;
begin
- Result := 0;//MediaPlayer.Position / 1000;
+ //Result := 0;//MediaPlayer.Position / 1000;
bytes := BASS_ChannelGetPosition(BASS);
Result := BASS_ChannelBytes2Seconds(BASS, bytes);
end;
@@ -902,8 +892,8 @@ end;
//Equalizer
function TMusic.GetFFTData: TFFTData;
-var
-Data: TFFTData;
+{var
+Data: TFFTData;}
begin
//Get Channel Data Mono and 256 Values
BASS_ChannelGetData(Bass, @Result, BASS_DATA_FFT512);
@@ -1013,4 +1003,4 @@ begin
end;
SetLength(BassVoices, 0);
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UParty.pas b/Game/Code/Classes/UParty.pas
index e9d21da3..22a4847c 100644
--- a/Game/Code/Classes/UParty.pas
+++ b/Game/Code/Classes/UParty.pas
@@ -80,9 +80,8 @@ Type
end;
var
- I, J, K: Integer;
+ I, K: Integer;
plugin_order: array of TOrder;
- temp: TOrder;
min, len: integer;
begin
@@ -123,8 +122,8 @@ end;
//----------
procedure TParty_Session.StartNewParty(NumRounds: Byte);
var
- TeamMode: Boolean;
- Len: Integer;
+ //TeamMode: Boolean;
+ //Len: Integer;
I, J: Integer;
NumMedleys: Integer;
@@ -153,13 +152,13 @@ begin
PlayersPlay := Teams.NumTeams;
//Get Teammode and Set Joker, also set TimesPlayed
- TeamMode := True;
+ //TeamMode := True;
For I := 0 to Teams.NumTeams-1 do
begin
- if Teams.Teaminfo[I].NumPlayers < 2 then
+ {if Teams.Teaminfo[I].NumPlayers < 2 then
begin
TeamMode := False;
- end;
+ end;}
//Set Player Attributes
For J := 0 to Teams.TeamInfo[I].NumPlayers-1 do
begin
diff --git a/Game/Code/Classes/UPartyM2.pas b/Game/Code/Classes/UPartyM2.pas
index d619c798..ccf3bf7f 100644
--- a/Game/Code/Classes/UPartyM2.pas
+++ b/Game/Code/Classes/UPartyM2.pas
@@ -145,6 +145,7 @@ var
found: boolean;
begin
found:=false;
+ Result := 0;
for i := 0 to length(SongsPlayed) - 1 do
begin
if SongsPlayed[i].cat = cat then
@@ -478,9 +479,8 @@ Type
end;
var
- I, J, K: Integer;
+ I, K: Integer;
plugin_order: array of TOrder;
- temp: TOrder;
min, len: integer;
begin
@@ -659,4 +659,4 @@ begin
end;
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/URecord.pas b/Game/Code/Classes/URecord.pas
index 2ec5439a..c478aebc 100644
--- a/Game/Code/Classes/URecord.pas
+++ b/Game/Code/Classes/URecord.pas
@@ -128,6 +128,7 @@ begin
// prepare to analyze
MaxW := 0;
+ MaxT := 0;
// analyze all 12 halftones
for T := 0 to 35 do begin // to 11, then 23, now 35 (for Whitney and my high voice)
@@ -207,8 +208,6 @@ var
L: integer;
S: integer;
PB: pbytearray;
- PW: pwordarray;
- SI: smallintarray;
PSI: psmallintarray;
I: integer;
Skip: integer;
@@ -224,6 +223,7 @@ begin
1: Boost := 2;
2: Boost := 4;
3: Boost := 8;
+ else Boost := 1;
end;
// boost buffer
@@ -368,4 +368,3 @@ begin
end;
end.
-
diff --git a/Game/Code/Classes/USkins.pas b/Game/Code/Classes/USkins.pas
index 547f4c2c..cc70f9ae 100644
--- a/Game/Code/Classes/USkins.pas
+++ b/Game/Code/Classes/USkins.pas
@@ -52,8 +52,8 @@ end;
procedure TSkin.LoadList;
var
SR: TSearchRec;
- SR2: TSearchRec;
- SLen: integer;
+ //SR2: TSearchRec;
+ //SLen: integer;
begin
if FindFirst('Skins\*', faDirectory, SR) = 0 then begin
repeat
@@ -67,7 +67,7 @@ end;
procedure TSkin.ParseDir(Dir: string);
var
SR: TSearchRec;
- SLen: integer;
+ //SLen: integer;
begin
if FindFirst(Dir + '*.ini', faAnyFile, SR) = 0 then begin
repeat
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas
index c605703d..e3289b8a 100644
--- a/Game/Code/Classes/USongs.pas
+++ b/Game/Code/Classes/USongs.pas
@@ -123,7 +123,7 @@ var
implementation
-uses UFiles, UIni, StrUtils, Umusic;
+uses UFiles, UIni, StrUtils, Umusic, UGraphic;
procedure TSongs.LoadSongList;
begin
@@ -203,10 +203,11 @@ begin
//Change Length Only every 50 Entrys
Inc(BrowsePos);
-
+
if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then
begin
- SetLength(Song, Length(Song) + 50);
+ UpdateScreenLoading('Songs: '+IntToStr(Length(Song)));
+ SetLength(Song, Length(Song) + 50);
end;
until FindNext(SR) <> 0;
@@ -336,9 +337,8 @@ var
CatNumber:integer; // Number of Song in Category
begin
CatNumShow := -1;
-// Songs.Sort(0); // by title
-case Ini.Sorting of
+ case Ini.Sorting of
sEdition: begin
Songs.Sort(sArtist);
Songs.Sort(sEdition);
@@ -357,8 +357,8 @@ case Ini.Sorting of
end;
sTitle: Songs.Sort(sTitle);
sArtist: Songs.Sort(sArtist);
- sTitle2: Songs.Sort(sTitle2); // by title2
- sArtist2: Songs.Sort(sArtist2); // by artist2
+ sTitle2: Songs.Sort(sTitle2); // by title2 ???
+ sArtist2: Songs.Sort(sArtist2); // by artist2 ???
end; // case
@@ -369,240 +369,123 @@ case Ini.Sorting of
CatNumber := 0;
//Songs leeren
- SetLength (Song, 0);
+ SetLength (CatSongs.Song, 0);
- for S := Low(Songs.Song) to High(Songs.Song) do begin
+ for S := Low(Songs.Song) to High(Songs.Song) do
+ begin
if (Ini.Tabs = 1) then
- if (Ini.Sorting = sEdition) and (CompareText(SS, Songs.Song[S].Edition) <> 0) then begin
- // add Category Button
- Inc(Order);
- SS := Songs.Song[S].Edition;
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := '[' + SS + ']';
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
- CatSongs.Song[CatLen].OrderNum := Order;
-
-
-
- // 0.4.3
- // if SS = 'Singstar' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar Part 2' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar German' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar Spanish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar Italian' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar French' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar.jpg';
- // if SS = 'Singstar Party' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Party.jpg';
- // if SS = 'Singstar Popworld' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Popworld.jpg';
- // if SS = 'Singstar 80s' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg';
- // if SS = 'Singstar 80s Polish' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar 80s.jpg';
- // if SS = 'Singstar Rocks' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Rocks.jpg';
- // if SS = 'Singstar Anthems' then CatSongs.Song[CatLen].Cover := CoversPath + 'Singstar Anthems.jpg';
-
- {// cover-patch
- if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';//}
-
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
-
- //CatNumber Patch
- if (SS <> '') then
+ begin
+ if (Ini.Sorting = sEdition) and
+ (CompareText(SS, Songs.Song[S].Edition) <> 0) then
begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
-
- CatSongs.Song[CatLen].Visible := true;
- end
+ // add Category Button
+ Inc(Order);
+ SS := Songs.Song[S].Edition;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := '[' + SS + ']';
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+ CatSongs.Song[CatLen].OrderNum := Order;
- else if (Ini.Sorting = sGenre) and (CompareText(SS, Songs.Song[S].Genre) <> 0) then begin
- // add Genre Button
- Inc(Order);
- SS := Songs.Song[S].Genre;
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := SS;
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
- CatSongs.Song[CatLen].OrderNum := Order;
-
- {// cover-patch
- if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
-
- //CatNumber Patch
- if (SS <> '') then
- begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
- CatSongs.Song[CatLen].Visible := true;
- end
+ //CatNumber Patch
+ if (SS <> '') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
- else if (Ini.Sorting = sLanguage) and (CompareText(SS, Songs.Song[S].Language) <> 0) then begin
- // add Language Button
- Inc(Order);
- SS := Songs.Song[S].Language;
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := SS;
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
- CatSongs.Song[CatLen].OrderNum := Order;
-
- {// cover-patch
- if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
-
- //CatNumber Patch
- if (SS <> '') then
+ CatSongs.Song[CatLen].Visible := true;
+ end else if (Ini.Sorting = sGenre) and
+ (CompareText(SS, Songs.Song[S].Genre) <> 0) then
begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
-
- CatSongs.Song[CatLen].Visible := true;
- end
+ // add Genre Button
+ Inc(Order);
+ SS := Songs.Song[S].Genre;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := SS;
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+ CatSongs.Song[CatLen].OrderNum := Order;
- else if (Ini.Sorting = sTitle) and (Length(Songs.Song[S].Title)>=1) and (Letter <> UpCase(Songs.Song[S].Title[1])) then begin
- // add a letter Category Button
- Inc(Order);
- Letter := UpCase(Songs.Song[S].Title[1]);
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
-// Order := ord(Letter);
- CatSongs.Song[CatLen].OrderNum := Order;
-
-
- {// cover-patch
- if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
-
- //CatNumber Patch
- if (Letter <> ' ') then
- begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
- CatSongs.Song[CatLen].Visible := true;
- end
+ //CatNumber Patch
+ if (SS <> '') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
- else if (Ini.Sorting = sArtist) and (Length(Songs.Song[S].Artist)>=1) and (Letter <> UpCase(Songs.Song[S].Artist[1])) then begin
- // add a letter Category Button
- Inc(Order);
- Letter := UpCase(Songs.Song[S].Artist[1]);
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
-// Order := ord(Letter);
- CatSongs.Song[CatLen].OrderNum := Order;
-
- {// cover-patch
- if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
-
- //CatNumber Patch
- if (Letter <> ' ') then
+ CatSongs.Song[CatLen].Visible := true;
+ end else if (Ini.Sorting = sLanguage) and
+ (CompareText(SS, Songs.Song[S].Language) <> 0) then
begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
-
- CatSongs.Song[CatLen].Visible := true;
- end
+ // add Language Button
+ Inc(Order);
+ SS := Songs.Song[S].Language;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := SS;
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+ CatSongs.Song[CatLen].OrderNum := Order;
- else if (Ini.Sorting = sFolder) and (CompareText(SS, Songs.Song[S].Folder) <> 0) then begin
- // 0.5.0: add folder tab
- Inc(Order);
- SS := Songs.Song[S].Folder;
- CatLen := Length(CatSongs.Song);
- SetLength(CatSongs.Song, CatLen+1);
- CatSongs.Song[CatLen].Artist := SS;
- CatSongs.Song[CatLen].Main := true;
- CatSongs.Song[CatLen].OrderTyp := 0;
- CatSongs.Song[CatLen].OrderNum := Order;
-
- {// cover-patch
- if FileExists(CoversPath + SS + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + SS + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
- CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
-
- //CatNumber Patch
- if (SS <> '') then
- begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
- CatSongs.Song[CatLen].Visible := true;
- end
+ //CatNumber Patch
+ if (SS <> '') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
- else if (Ini.Sorting = sTitle2) AND (Length(Songs.Song[S].Title)>=1) then begin
- if (ord(Songs.Song[S].Title[1]) > 47) and (ord(Songs.Song[S].Title[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Title[1]);
- if (Letter <> Letter2) then begin
+ CatSongs.Song[CatLen].Visible := true;
+ end else if (Ini.Sorting = sTitle) and
+ (Length(Songs.Song[S].Title)>=1) and
+ (Letter <> UpCase(Songs.Song[S].Title[1])) then
+ begin
// add a letter Category Button
Inc(Order);
- Letter := Letter2;
+ Letter := UpCase(Songs.Song[S].Title[1]);
CatLen := Length(CatSongs.Song);
SetLength(CatSongs.Song, CatLen+1);
CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
CatSongs.Song[CatLen].Main := true;
CatSongs.Song[CatLen].OrderTyp := 0;
-// Order := ord(Letter);
CatSongs.Song[CatLen].OrderNum := Order;
- {// cover-patch
- if FileExists(CoversPath + 'Title' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Title' + Letter + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
//CatNumber Patch
- if (Letter <> ' ') then
- begin
- if (CatLen - CatNumber - 1>=0) then
- Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
- CatNumber := 0;
- end;
+ if (Letter <> ' ') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
CatSongs.Song[CatLen].Visible := true;
- end;
- end
-
- else if (Ini.Sorting = sArtist2) AND (Length(Songs.Song[S].Artist)>=1) then begin
- if (ord(Songs.Song[S].Artist[1]) > 47) and (ord(Songs.Song[S].Artist[1]) < 58) then Letter2 := '#' else Letter2 := UpCase(Songs.Song[S].Artist[1]);
- if (Letter <> Letter2) then begin
+ end else if (Ini.Sorting = sArtist) and
+ (Length(Songs.Song[S].Artist)>=1) and
+ (Letter <> UpCase(Songs.Song[S].Artist[1])) then
+ begin
// add a letter Category Button
Inc(Order);
- Letter := Letter2;
+ Letter := UpCase(Songs.Song[S].Artist[1]);
CatLen := Length(CatSongs.Song);
SetLength(CatSongs.Song, CatLen+1);
CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
CatSongs.Song[CatLen].Main := true;
CatSongs.Song[CatLen].OrderTyp := 0;
-// Order := ord(Letter);
CatSongs.Song[CatLen].OrderNum := Order;
- {// cover-patch
- if FileExists(CoversPath + 'Artist' + Letter + '.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'Artist' + Letter + '.jpg'
- else if FileExists(CoversPath + 'NoCover.jpg') then CatSongs.Song[CatLen].Cover := CoversPath + 'NoCover.jpg';}
CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
//CatNumber Patch
@@ -612,12 +495,102 @@ case Ini.Sorting of
Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
CatNumber := 0;
end;
-
+
CatSongs.Song[CatLen].Visible := true;
+ end else if (Ini.Sorting = sFolder) and
+ (CompareText(SS, Songs.Song[S].Folder) <> 0) then
+ begin
+ // 0.5.0: add folder tab
+ Inc(Order);
+ SS := Songs.Song[S].Folder;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := SS;
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+ CatSongs.Song[CatLen].OrderNum := Order;
+
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, SS);
+
+ //CatNumber Patch
+ if (SS <> '') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
+
+ CatSongs.Song[CatLen].Visible := true;
+ end else if (Ini.Sorting = sTitle2) AND
+ (Length(Songs.Song[S].Title)>=1) then
+ begin
+ if (ord(Songs.Song[S].Title[1]) > 47) and
+ (ord(Songs.Song[S].Title[1]) < 58) then
+ Letter2 := '#'
+ else
+ Letter2 := UpCase(Songs.Song[S].Title[1]);
+
+ if (Letter <> Letter2) then
+ begin
+ // add a letter Category Button
+ Inc(Order);
+ Letter := Letter2;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+
+ CatSongs.Song[CatLen].OrderNum := Order;
+
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
+
+ //CatNumber Patch
+ if (Letter <> ' ') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
+
+ CatSongs.Song[CatLen].Visible := true;
+ end;
+ end else if (Ini.Sorting = sArtist2) AND
+ (Length(Songs.Song[S].Artist)>=1) then
+ begin
+ if (ord(Songs.Song[S].Artist[1]) > 47) and
+ (ord(Songs.Song[S].Artist[1]) < 58) then
+ Letter2 := '#'
+ else
+ Letter2 := UpCase(Songs.Song[S].Artist[1]);
+
+ if (Letter <> Letter2) then
+ begin
+ // add a letter Category Button
+ Inc(Order);
+ Letter := Letter2;
+ CatLen := Length(CatSongs.Song);
+ SetLength(CatSongs.Song, CatLen+1);
+ CatSongs.Song[CatLen].Artist := '[' + Letter + ']';
+ CatSongs.Song[CatLen].Main := true;
+ CatSongs.Song[CatLen].OrderTyp := 0;
+ CatSongs.Song[CatLen].OrderNum := Order;
+
+ CatSongs.Song[CatLen].Cover := CatCovers.GetCover(Ini.Sorting, Letter);
+
+ //CatNumber Patch
+ if (Letter <> ' ') then
+ begin
+ if (CatLen - CatNumber - 1>=0) then
+ Song[CatLen - CatNumber - 1].CatNumber := CatNumber;//Set CatNumber of Categroy
+ CatNumber := 0;
+ end;
+
+ CatSongs.Song[CatLen].Visible := true;
+ end;
end;
end;
-
CatLen := Length(CatSongs.Song);
SetLength(CatSongs.Song, CatLen+1);
@@ -627,17 +600,19 @@ case Ini.Sorting of
CatSongs.Song[CatLen].OrderNum := Order; // assigns category
CatSongs.Song[CatLen].CatNumber := CatNumber;
- if (Ini.Tabs = 0) then CatSongs.Song[CatLen].Visible := true
- else if (Ini.Tabs = 1) then CatSongs.Song[CatLen].Visible := false;
-// if (Ini.Tabs = 1) and (Order = 1) then CatSongs.Song[CatLen].Visible := true; // open first tab
-//CatSongs.Song[CatLen].Visible := true;
-
+ if (Ini.Tabs = 0) then
+ begin
+ CatSongs.Song[CatLen].Visible := true;
+ CatSongs.Song[CatLen].Main := false;
+ end else if (Ini.Tabs = 1) then
+ CatSongs.Song[CatLen].Visible := false;
end;
-//CatNumber Patch - Set CatNumber of Last Category
-if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then
- Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy
-//CatCount Patch
-CatCount := Order;
+
+ //CatNumber Patch - Set CatNumber of Last Category
+ if (ini.Tabs_at_startup = 1) And (high(Song) >=1) then
+ Song[CatLen - CatNumber].CatNumber := CatNumber;//Set CatNumber of Categroy
+ //CatCount Patch
+ CatCount := Order;
end;
procedure TCatSongs.ShowCategory(Index: integer);
@@ -666,7 +641,7 @@ end;
procedure TCatSongs.ClickCategoryButton(Index: integer);
var
- Num, S: integer;
+ Num: integer;
begin
Num := CatSongs.Song[Index].OrderNum;
if Num <> CatNumShow then
@@ -681,7 +656,7 @@ end;
//Hide Categorys when in Category Hack
procedure TCatSongs.ShowCategoryList;
var
- Num, S: integer;
+ S: integer;
begin
//Hide All Songs Show All Cats
for S := 0 to high(CatSongs.Song) do begin
@@ -791,4 +766,4 @@ begin
end;
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas
index f5f47ed9..1e5bd276 100644
--- a/Game/Code/Classes/UTexture.pas
+++ b/Game/Code/Classes/UTexture.pas
@@ -126,7 +126,7 @@ function TTextureUnit.GetTexture(Name, Typ: string; FromCache: boolean): TTextur
var
T: integer; // texture
C: integer; // cover
- Data: array of byte;
+
begin
// find texture entry
T := FindTexture(Name);
@@ -801,13 +801,8 @@ end;
function TTextureUnit.CreateTexture(var Data: array of byte; Name: string; W, H: word; Bits: byte): TTexture;
var
- Pet: integer;
- Pet2: integer;
- Pix: integer;
- ColInt: real;
- PPix: PByteArray;
- TempA: integer;
Error: integer;
+
begin
Mipmapping := false;
diff --git a/Game/Code/Classes/UThemes.pas b/Game/Code/Classes/UThemes.pas
index dd90987d..f43143a6 100644
--- a/Game/Code/Classes/UThemes.pas
+++ b/Game/Code/Classes/UThemes.pas
@@ -991,7 +991,6 @@ end;
function TTheme.LoadTheme(FileName: string; sColor: integer): boolean;
var
I, J: integer;
- Path: string;
begin
create_theme_objects();
@@ -1941,8 +1940,6 @@ begin
end;
procedure TTheme.ThemeLoadSelect(var ThemeSelect: TThemeSelect; Name: string);
-var
- C: integer;
begin
DecimalSeparator := '.';
@@ -1987,8 +1984,6 @@ begin
end;
procedure TTheme.ThemeLoadSelectSlide(var ThemeSelectS: TThemeSelectSlide; Name: string);
-var
- C: integer;
begin
DecimalSeparator := '.';
@@ -2043,8 +2038,7 @@ var
SL: TStringList;
C: integer;
S: string;
- Col: integer;
- RGB: TRGB;
+
begin
SL := TStringList.Create;
ThemeIni.ReadSection('Colors', SL);
@@ -2619,4 +2613,4 @@ begin
end;
-end.
+end. \ No newline at end of file
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 9e04a8ec..25c13886 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -36,10 +36,6 @@ uses SDL,
{$ENDIF}
UIni;
-const
- //PIXEL_FORMAT = GL_RGB;
- numBytes = 3;
-
type
TRectCoords = record //from 1.1
Left, Right: double;
@@ -69,45 +65,61 @@ procedure ResetAspectCorrection;
var
- VideoOpened, VideoPaused: Boolean;
- VideoTex: glUint;
- //TexData: array of Byte;
- VideoStreamIndex: Integer;
- SkipLines: Integer;
- LastSkipLines: Integer;
- mmfps: Real;
- Counter: Integer;
- //myBuffer: pByte;
- TexX, TexY, dataX, dataY: Cardinal;
- VideoTimeBase, VideoTime, LastFrameTime, TimeDifference, NegativeSkipTime: Extended;
- ScaledVideoWidth, ScaledVideoHeight: Real;
- VideoAspect: Real;
- VideoSkipTime: Single;
- ActualH, ActualW: Integer;
-
- inst: PAc_instance;
- pack: PAc_package;
- info: TAc_stream_info;
- videodecoder: PAc_decoder;
+ VideoOpened: Boolean;
+ VideoPaused: Boolean;
+ VideoTex: glUint;
+
+ VideoStreamIndex: Integer;
+ SkipLines: Integer;
+ LastSkipLines: Integer;
+ mmfps: Real;
+ Counter: Integer;
+
+ TexX, TexY: Integer;
+ dataX, dataY: Integer;
+
+ VideoTimeBase: Extended;
+ VideoTime: Extended;
+ LastFrameTime: Extended;
+ TimeDifference: Extended;
+ NegativeSkipTime: Extended;
+
+ ScaledVideoWidth: Real;
+ ScaledVideoHeight: Real;
+
+ VideoAspect: Real;
+ VideoSkipTime: Single;
+ ActualH, ActualW: Integer;
+
+ inst: PAc_instance;
+ pack: PAc_package;
+ info: TAc_stream_info;
+ videodecoder: PAc_decoder;
- fAspect: real; //**< width/height ratio (from 1.1)
- fAspectCorrection: TAspectCorrection; //from 1.1
+ fAspect: Real; //**< width/height ratio (from 1.1)
+ fAspectCorrection: TAspectCorrection; //from 1.1
- fs: TFileStream;
- fName: string;
+ fs: TFileStream;
+ fName: String;
+
+ timediff_str: String; //for debug
+ mtime_str: String; //for debug
+
+ pbo: glUint;
+ pbo_supported: Boolean;
+ PIXEL_FORMAT: glUint;
+ numBytes: Integer;
+
+ EnableVideoDraw: boolean;
- timediff: PChar; //for debug
- timediff_str: string; //for debug
- mtime: PChar; //for debug
- mtime_str: string; //for debug
- pbo: glUint;
- pbo_supported: boolean;
implementation
uses
- UGraphic, ULog, UDisplay;
+ UGraphic,
+ ULog,
+ UDisplay;
function read_proc(sender: Pointer; buf: PByte; size: integer): integer; cdecl;
begin
@@ -131,30 +143,27 @@ begin
fName := '';
glGenTextures(1, @VideoTex);
-
- //pbo_supported := glext_LoadExtension('GL_ARB_pixel_buffer_object') and
- // glext_LoadExtension('GL_version_1_5');
- pbo_supported := false;
+
if (pbo_supported) then
glGenBuffers(1, @pbo);
- //SetLength(TexData,0);
-
fAspectCorrection := TAspectCorrection(Ini.AspectCorrect);
SkipLines := 0;
LastSkipLines := 0;
Counter := 0;
+ PIXEL_FORMAT := GL_RGB;
+ numBytes := 3;
+ EnableVideoDraw := true;
end;
procedure acOpenFile(FileName: pAnsiChar);
var
I: integer;
- rTimeBase: Extended;
+
begin
VideoPaused := False;
VideoTimeBase := 0;
- rTimeBase := 0;
VideoTime := 0;
LastFrameTime := 0;
TimeDifference := 0;
@@ -213,9 +222,6 @@ begin
TexY := videodecoder^.stream_info.additional_info.video_info.frame_height;
dataX := Round(Power(2, Ceil(Log2(TexX))));
dataY := Round(Power(2, Ceil(Log2(TexY))));
- //SetLength(TexData, TexX*numBytes);
- //for I := 0 to TexX*numBytes - 1 do
- // TexData[I]:=0;
// calculate some information for video display
VideoAspect:=videodecoder^.stream_info.additional_info.video_info.pixel_aspect;
@@ -238,11 +244,10 @@ begin
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexImage2D(GL_TEXTURE_2D, 0, 3, dataX, dataY, 0,
- GL_RGB, GL_UNSIGNED_BYTE, nil);
-
+ PIXEL_FORMAT, GL_UNSIGNED_BYTE, nil);
glBindTexture(GL_TEXTURE_2D, 0);
+
if(pbo_supported) then
begin
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
@@ -250,9 +255,6 @@ begin
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
end;
- //SkipLines := 0;
- //LastSkipLines := 0;
- //Counter := 0;
mmfps := 50;
end;
@@ -262,13 +264,14 @@ begin
if videodecoder <> nil then
ac_free_decoder(videodecoder);
+
videodecoder:=nil;
ac_close(inst);
ac_free(inst);
inst := nil;
fs.Free;
fs:=nil;
- //SetLength(TexData,0);
+
VideoOpened:=False;
fName := '';
end;
@@ -281,25 +284,13 @@ begin
end;
procedure acSkip2(Gap: Single; Start: Single);
-var
- seek_target: uint64;
begin
VideoSkiptime:=Gap;
NegativeSkipTime:=Start+Gap;
if Start+Gap > 0 then
begin
VideoTime:=Start+Gap;
- //ac_seek(videodecoder, 0, Floor((Start+Gap)*1000));
ac_seek(videodecoder, -1, Floor((Start+Gap)*1000));
- //acSearch(Gap+Start);
- {if (ac_seek(videodecoder, -1, Floor((Start+Gap)*1000))=0) then
- if (ac_seek(videodecoder, 0, Floor((Start+Gap)*1000))=0) then
- begin
- ac_seek(videodecoder, 0, 0);
- VideoTime:=0;
- //acSearch(Gap+Start);
-
- end; }
end else
begin
ac_seek(videodecoder, 0, 0);
@@ -308,8 +299,6 @@ begin
end;
procedure acSkip(Gap: Single; Start: Single);
-var
- seek_target: uint64;
begin
VideoSkiptime:=Gap;
NegativeSkipTime:=Start+Gap;
@@ -336,7 +325,6 @@ var
errnum: Integer;
FrameDataPtr: PByteArray;
myTime: Extended;
- DropFrame: Boolean;
begin
Result := 0;
@@ -346,39 +334,15 @@ begin
myTime:=Time+VideoSkipTime;
TimeDifference:=myTime-VideoTime;
- if Ini.Debug = 1 then
- begin
- timediff_str:= 't-diff: ' + FormatFloat('#0.00', TimeDifference);
- timediff := Addr(timediff_str[1]);
- mtime_str:= 'mytime: ' + FormatFloat('#0.00', myTime);
- mtime := Addr(mtime_str[1]);
- end;
- DropFrame:=False;
if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin
- if Ini.Debug = 1 then
- begin
- // frame delay debug display
- GoldenRec.Spawn(200,65,1,16,0,-1,ColoredStar,$00ff00);
- end;
Exit;// we don't need a new frame now
end;
- if TimeDifference >= 2*VideoTimeBase then
- begin // skip frames
- if Ini.Debug = 1 then
- begin
- //frame drop debug display
- GoldenRec.Spawn(200,105,1,16,0,-1,ColoredStar,$ff0000);
- end;
-
- DropFrame:=True;
- end;
-
pack := ac_read_package(inst);
FrameFinished:=0;
// read packets until we have a finished frame (or there are no more packets)
- while ({(FrameFinished=0) or }(VideoTime < Time-VideoTimeBase)) and (pack <> nil) do
+ while ((VideoTime < Time-VideoTimeBase)) and (pack <> nil) do
begin
// if we got a packet from the video stream, then decode it
if (videodecoder^.stream_index = pack^.stream_index) then
@@ -386,13 +350,12 @@ begin
FrameFinished := ac_decode_package(pack, videodecoder);
VideoTime := videodecoder^.timecode;
ac_free_package(pack);
- if ((VideoTime < Time-VideoTimeBase) {or (FrameFinished=0)}) then
+ if ((VideoTime < Time-VideoTimeBase)) then
pack := ac_read_package(inst);
end else
begin
ac_free_package(pack);
pack := ac_read_package(inst);
- //TimeDifference:=myTime-VideoTime;
end;
end;
if (pack<>nil) then
@@ -401,7 +364,6 @@ begin
// if we did not get an new frame, there's nothing more to do
if Framefinished=0 then
begin
-// GoldenRec.Spawn(220,15,1,16,0,-1,ColoredStar,$0000ff);
Exit;
end;
@@ -410,9 +372,8 @@ begin
FrameDataPtr:=Pointer(videodecoder^.buffer);
Result := 1;
glBindTexture(GL_TEXTURE_2D, VideoTex);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[0]);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY, PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[0]);
+
if Ini.Debug = 1 then
begin
//frame decode debug display
@@ -424,18 +385,17 @@ end;
procedure acGetFrame(Time: Extended);
var
- FrameFinished: Integer;
- errnum, x, y: Integer;
- FrameDataPtr: PByteArray;
- FrameDataPtr2: PByteArray;
- linesize: integer;
- myTime: Extended;
- DropFrame: Boolean;
- droppedFrames: Integer;
- I, J: Integer;
-
- glError: glEnum;
- glErrorStr: String;
+ FrameFinished: Integer;
+ errnum: Integer;
+ FrameDataPtr: PByteArray;
+ FrameDataPtr2: PByteArray;
+ myTime: Extended;
+ DropFrame: Boolean;
+ droppedFrames: Integer;
+ I: Integer;
+
+ glError: glEnum;
+ glErrorStr: String;
const
FRAMEDROPCOUNT=3;
begin
@@ -445,13 +405,13 @@ begin
myTime:=Time+VideoSkipTime;
TimeDifference:=myTime-VideoTime;
+
if Ini.Debug = 1 then
begin
timediff_str:= 't-diff: ' + FormatFloat('#0.00', TimeDifference);
- timediff := Addr(timediff_str[1]);
mtime_str:= 'mytime: ' + FormatFloat('#0.00', myTime);
- mtime := Addr(mtime_str[1]);
end;
+
DropFrame:=False;
if (VideoTime <> 0) and (TimeDifference <= VideoTimeBase) then begin
@@ -568,13 +528,11 @@ begin
begin
if(I mod (SkipLines+1) = 0) then
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, (I div (SkipLines+1)), TexX, 1,
- GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[I*numBytes*TexX]);
+ PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[I*numBytes*TexX]);
end;
end else
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY,
- GL_RGB, GL_UNSIGNED_BYTE, @FrameDataPtr[0]);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- //glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ PIXEL_FORMAT, GL_UNSIGNED_BYTE, @FrameDataPtr[0]);
end else
begin
glGetError();
@@ -619,7 +577,7 @@ begin
end;
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, TexX, TexY,
- GL_RGB, GL_UNSIGNED_BYTE, 0);
+ PIXEL_FORMAT, GL_UNSIGNED_BYTE, nil);
glError := glGetError;
if glError <> GL_NO_ERROR then
@@ -658,8 +616,6 @@ begin
acoStretch : fAspectCorrection := acoLetterBox;
acoLetterBox : fAspectCorrection := acoCrop;
end;
- //Ini.AspectCorrect := integer(fAspectCorrection);
- //Ini.Save;
end;
procedure SetAspectCorrection(aspect: TAspectCorrection);
@@ -741,7 +697,10 @@ begin
TexRect.Left := 0;
TexRect.Right := TexX / dataX;
TexRect.Upper := 0;
- TexRect.Lower := (TexY/(SkipLines+1)) / dataY;
+ if (not pbo_supported) then
+ TexRect.Lower := (TexY/(SkipLines+1)) / dataY
+ else
+ TexRect.Lower := TexY/ dataY;
end;
procedure acDrawGL(Screen: integer);
@@ -758,22 +717,14 @@ end;
procedure acDrawGLi(Screen: integer; Window: TRectCoords; Blend: real);
var
- text: string;
- test: PChar;
ScreenRect, TexRect: TRectCoords;
- FrameDataPtr: PByteArray;
- FrameDataPtr2: PByteArray;
- Offset: Integer;
begin
// have a nice black background to draw on (even if there were errors opening the vid)
if Not Window.windowed then
begin
- glDisable(GL_BLEND);
- //glDisable(GL_DEPTH_TEST);
- //glDepthMask(GL_FALSE);
- //glDisable(GL_CULL_FACE);
-
+ //glDisable(GL_BLEND);
+
glScissor(round((ScreenW/Screens)*(Screen-1)),
0,
round(ScreenW/Screens),
@@ -784,17 +735,18 @@ begin
glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
- end else
- glEnable(GL_BLEND);
+ end;{ else if EnableVideoDraw then
+ glEnable(GL_BLEND);}
+
+ if not EnableVideoDraw then
+ Exit;
// exit if there's nothing to draw
- if not VideoOpened then Exit;
- // if we're still inside negative skip, then exit
- //if (NegativeSkipTime < 0) then Exit;
+ if not VideoOpened then
+ Exit;
GetVideoRect(ScreenRect, TexRect, Window);
-
if Window.windowed then
begin
glScissor(round((Window.Left)*(ScreenW/Screens)/RenderW+(ScreenW/Screens)*(Screen-1)),
@@ -807,7 +759,7 @@ begin
glEnable(GL_TEXTURE_2D);
glColor4f(1, 1, 1, Blend);
glBindTexture(GL_TEXTURE_2D, VideoTex);
-
+ //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glbegin(gl_quads);
// upper-left coord
glTexCoord2f(TexRect.Left, TexRect.Upper);
@@ -823,41 +775,44 @@ begin
glVertex2f(ScreenRect.Right, ScreenRect.Upper);
glEnd;
+ //glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glDisable(GL_TEXTURE_2D);
- //glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);
+ glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_SCISSOR_TEST);
- glDisable(GL_BLEND);
+ //glDisable(GL_BLEND);
- if (Ini.MovieSize < 1) then //HalfSize BG
+ if (Ini.MovieSize < 1) and not Window.windowed then //HalfSize BG
begin
// draw fading bars over top and bottom of background/video
glEnable(GL_BLEND);
glBegin(GL_QUADS);
(* black top *)
- glColor4f(0,0,0,1);
+ glColor4f(0, 0, 0, 1);
glVertex2f(0, 0);
- glVertex2f(800,0);
- glVertex2f(800,110);
- glVertex2f(0,110);
+ glVertex2f(RenderW, 0);
+ glVertex2f(RenderW, 110);
+ glVertex2f(0, 110);
+
(* top gradient *)
glVertex2f(0, 110);
- glVertex2f(800,110);
- glColor4f(0,0,0,0);
- glVertex2f(800,130);
- glVertex2f(0,130);
+ glVertex2f(RenderW, 110);
+ glColor4f(0, 0, 0, 0);
+ glVertex2f(RenderW, 130);
+ glVertex2f(0, 130);
(* bottom gradient *)
- glColor4f(0,0,0,0);
- glVertex2f(0, 600-130);
- glVertex2f(800,600-130);
- glColor4f(0,0,0,1);
- glVertex2f(800,600-110);
- glVertex2f(0,600-110);
+ glColor4f(0, 0, 0, 0);
+ glVertex2f(0, RenderH-130);
+ glVertex2f(RenderW, RenderH-130);
+ glColor4f(0, 0, 0, 1);
+ glVertex2f(RenderW, RenderH-110);
+ glVertex2f(0, RenderH-110);
+
(* black bottom *)
- glVertex2f(0, 600-110);
- glVertex2f(800,600-110);
- glVertex2f(800,600);
- glVertex2f(0,600);
+ glVertex2f(0, RenderH-110);
+ glVertex2f(RenderW, RenderH-110);
+ glVertex2f(RenderW, RenderH);
+ glVertex2f(0, RenderH);
glEnd;
glDisable(GL_BLEND);
@@ -892,15 +847,14 @@ begin
SetFontItalic(False);
SetFontSize(7);
SetFontPos (5, 50);
- text:= 'vtime: ' + FormatFloat('#0.00', VideoTime);
- test := Addr(text[1]);
- glPrint(test);
+ glPrint(PChar('vtime: ' + FormatFloat('#0.00', VideoTime)));
+
SetFontPos (5, 65);
- //text:= 'vtime: ' + FormatFloat('#0.00', videodecoder^.timecode);
- //test := Addr(text[1]);
- glPrint(timediff);
+ glPrint(PChar(timediff_str));
+
SetFontPos (5, 80);
- glPrint(mtime);
+ glPrint(PChar(mtime_str));
+
SetFontPos (5, 95);
case fAspectCorrection of
acoCrop : glPrint('Crop');
@@ -916,4 +870,4 @@ begin
end;
end;
-end.
+end. \ No newline at end of file