aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-30 09:31:51 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-05-30 09:31:51 +0000
commitea92932825739b6d7f5ac1434382a1a59a0371fd (patch)
tree15c0807b5fdbe064a1a9a786a12d308650aeac61 /Game/Code/Classes
parentbb4a6304aab5a215055813617130c01d91d80a83 (diff)
downloadusdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.tar.gz
usdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.tar.xz
usdx-ea92932825739b6d7f5ac1434382a1a59a0371fd.zip
- new acinerella.dll (based on 1.4)
- the song does not restart if you change the video gap in the editor while playing - some corrections in Blue Sensation theme; darker sing notes graphics - some bugfixes - max fps at ~200 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2425 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes')
-rw-r--r--Game/Code/Classes/UGraphic.pas56
-rw-r--r--Game/Code/Classes/UMain.pas8
-rw-r--r--Game/Code/Classes/USongs.pas44
-rw-r--r--Game/Code/Classes/UVideo.pas12
4 files changed, 54 insertions, 66 deletions
diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas
index 4aed06f3..7604e68e 100644
--- a/Game/Code/Classes/UGraphic.pas
+++ b/Game/Code/Classes/UGraphic.pas
@@ -257,13 +257,12 @@ begin
Log.LogStatus('LoadOpenGL', 'Initialize3D');
Log.BenchmarkStart(2);
- LoadOpenGL( GLLibName );
-
+ {
Log.LogStatus('SDL_Init', 'Initialize3D');
- if ( SDL_Init(SDL_INIT_VIDEO or SDL_INIT_AUDIO)= -1 ) then begin
+ if ( SDL_Init(SDL_INIT_VIDEO)= -1 ) then begin
Log.LogError('SDL_Init Failed', 'Initialize3D');
exit;
- end;
+ end;}
{ //Load Icon
Res := TResourceStream.CreateFromID(HInstance, 3, RT_ICON);
@@ -331,10 +330,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);}
+ glOrtho(0, RenderW, RenderH, 0, -1, 100);
+ glMatrixMode(GL_MODELVIEW);
end;
procedure Reinitialize3D;
@@ -395,7 +394,8 @@ begin
videoFlags := videoFlags or SDL_SWSURFACE;
if ( videoInfo.blit_hw <> 0 ) then videoFlags := videoFlags or SDL_HWACCEL;
-
+ //LoadOpenGL( GLLibName );
+
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
@@ -404,18 +404,6 @@ begin
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, videoFlags)
else begin
@@ -427,17 +415,35 @@ 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);
- SwapBuffers;
+
+ // Load OpenGL 1.2 extensions for OpenGL 1.2 compatibility
+ if (not Load_GL_version_1_2()) then
+ begin
+ Log.LogError('Failed loading OpenGL 1.2');
+ end;
+
+ 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;
// zmienne
RenderW := 800;
RenderH := 600;
ScreenW := W;
ScreenH := H;
+
+ // clear screen once window is being shown
+ glClearColor(1, 1, 1, 1);
+ glClear(GL_COLOR_BUFFER_BIT);
+ SwapBuffers;
end;
procedure LoadScreens( aShowLoading : boolean = true );
diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas
index a20ba30c..c56513d1 100644
--- a/Game/Code/Classes/UMain.pas
+++ b/Game/Code/Classes/UMain.pas
@@ -135,9 +135,9 @@ begin
// delay
CountMidTime;
- Delay := Floor(1000 / 100 - 1000 * TimeMid);
+ Delay := Floor(1000 / 200 - 1000 * TimeMid);
if Delay >= 1 then
- SDL_Delay(Delay); // dynamic, maximum is 100 fps
+ SDL_Delay(Delay);
CountSkipTime;
// reinitialization of graphics
@@ -163,14 +163,14 @@ Begin
SDL_SetModState(KMOD_NONE);
if (Ini.FullScreen = 1) or (Params.FullScreen) then
SDL_ShowCursor(0);
- EnableVideoDraw := true;
+ //EnableVideoDraw := true;
end;
if (Event.active.gain=0) then
begin
if (Ini.FullScreen = 1) or (Params.FullScreen) then
SDL_ShowCursor(1);
- EnableVideoDraw := false;
+ //EnableVideoDraw := false;
end;
end;
diff --git a/Game/Code/Classes/USongs.pas b/Game/Code/Classes/USongs.pas
index f5b105be..3c6e147a 100644
--- a/Game/Code/Classes/USongs.pas
+++ b/Game/Code/Classes/USongs.pas
@@ -146,26 +146,22 @@ var
SR: TSearchRec; // for parsing Songs Directory
SLen: integer;
res: boolean;
+
begin
if FindFirst(Dir + '*', faDirectory, SR) = 0 then begin
repeat
if (SR.Name <> '.') and (SR.Name <> '..') then
- BrowseDir(Dir + Sr.Name + '\');
+ BrowseDir(Dir + SR.Name + '\');
until FindNext(SR) <> 0;
end; // if
FindClose(SR);
-// Log.LogStatus('Parsing directory: ' + Dir + SR.Name, 'LoadSongList');
-
- if FindFirst(Dir + '*.txt', 0, SR) = 0 then begin
-// Log.LogStatus('Parsing file: ' + Dir + SR.Name + '\' + SRD.Name, 'LoadSongList');
+ if FindFirst(Dir + '*.txt', 0, SR) = 0 then
+ begin
repeat
//New Mod for better Memory Management
SLen := BrowsePos;
- {//Old
- SLen := Length(Song);
- SetLength(Song, SLen + 1);//}
Song[SLen].Path := Dir;
Song[SLen].Folder := Copy(Dir, Length(SongPath)+1, 10000);
@@ -184,34 +180,24 @@ begin
begin
Song[SLen]:=AktSong;
FindRefrainStart(Song[SLen]);
- end;
- end;
- if (not res) then Dec(BrowsePos)
- else begin
- // scanning complete, file is good
- // if there is no cover then try to find it
- if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg');
-// if Song[SLen].Background = '' then begin
-// Song[SLen].Background := FindSongFile(Dir, '*[BG].jpg');
-// end; // no needed here}
-
- // fix by adding path. no, don't fix it.
-// if Song[SLen].Cover <> '' then
-// Song[SLen].Cover := Song[SLen].Path + Song[SLen].Cover;
+ // scanning complete, file is good
+ // if there is no cover then try to find it
+ if Song[SLen].Cover = '' then Song[SLen].Cover := FindSongFile(Dir, '*[CO].jpg');
+
+ Inc(BrowsePos);
+ end;
end;
//Change Length Only every 50 Entrys
- Inc(BrowsePos);
-
- if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) then
- begin
- UpdateScreenLoading('Songs: '+IntToStr(Length(Song)));
+ if (BrowsePos mod 50 = 0) AND (BrowsePos <> 0) and res then
SetLength(Song, Length(Song) + 50);
- end;
+
+ if (BrowsePos mod 5 = 0) and res then
+ UpdateScreenLoading('Songs: '+IntToStr(BrowsePos));
until FindNext(SR) <> 0;
- end; // if FindFirst
+ end; // if FindFirst
FindClose(SR);
end;
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index 8d56182e..ee3d2bbd 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -130,10 +130,7 @@ end;
function seek_proc(sender: Pointer; pos: int64; whence: integer): int64; cdecl;
begin
- if whence in [0, 1, 2] then
- result := fs.Seek(pos, TSeekOrigin(whence))
- else
- result := -1;
+ result := fs.Seek(pos, TSeekOrigin(whence))
end;
procedure Init;
@@ -180,7 +177,7 @@ begin
inst := ac_init();
videodecoder := nil;
- ac_open(inst, nil, nil, @read_proc, @seek_proc, nil);
+ ac_open(inst, nil, nil, @read_proc, @seek_proc, nil, nil);
if not inst^.opened then
begin
@@ -251,12 +248,12 @@ begin
PIXEL_FORMAT, GL_UNSIGNED_BYTE, nil);
glBindTexture(GL_TEXTURE_2D, 0);
- if(pbo_supported) then
+ if(pbo_supported) then
begin
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, pbo);
glBufferData(GL_PIXEL_UNPACK_BUFFER_ARB, numBytes*TexX*TexY, nil, GL_STREAM_DRAW);
glBindBuffer(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
- end;
+ end;
mmfps := 50;
end;
@@ -812,7 +809,6 @@ begin
// upper-right coord
glTexCoord2f(TexRect.Right, TexRect.Upper);
glVertex2f(ScreenRect.Right, ScreenRect.Upper);
-
glEnd;
if Window.windowed then