From 707441e6eac0f628f9c61f0130df07c6768ba291 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 11:45:24 +0000 Subject: tidy texture loading. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@421 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 3 +-- Game/Code/Classes/UGraphic.pas | 9 +++++++-- Game/Code/Classes/UTexture.pas | 17 ++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index 1e4a9f6a..c228b40a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -79,8 +79,7 @@ procedure BuildFont; // Build Our Bitmap Font Rejestr: TResourceStream; begin {$IFNDEF FPC} - Log.LogStatus( 'TextGL - BUILDFONT - load Font Resource - ' + inttostr( integer( aID ) ) , aType +' '+ aResourceName ); - + Rejestr := TResourceStream.Create(HInstance, aResourceName , pchar( aType ) ); try Rejestr.Read(Fonts[ aID ].Width, 256); diff --git a/Game/Code/Classes/UGraphic.pas b/Game/Code/Classes/UGraphic.pas index 7094c0f9..a8728fa7 100644 --- a/Game/Code/Classes/UGraphic.pas +++ b/Game/Code/Classes/UGraphic.pas @@ -383,8 +383,13 @@ begin // Show the Loading Screen ------------- LoadLoadingScreen; - - + Log.LogStatus('Loading Screens', 'Initialize3D'); + + +// LoadTextures; // jb +// Log.LogStatus(' Loading Textures', ''); + + // now that we have something to display while loading, // start thread that loads the rest of ultrastar diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas index 389dd0b0..f01cfd23 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -90,8 +90,8 @@ type TTextureUnit = class private - function LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; - function LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; + function LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; + function LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; public Limit: integer; CreateCacheMipmap: boolean; @@ -312,7 +312,7 @@ begin end; -function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boolean; +function TTextureUnit.LoadBitmap( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; begin result := false; try @@ -325,7 +325,7 @@ begin end; end; -function TTextureUnit.LoadJpeg( aSourceStream : TStream; aIMG : TBitMap ): boolean; +function TTextureUnit.LoadJpeg( const aSourceStream : TStream; const aIMG : TBitMap ): boolean; var TextureJ: TJPEGImage; begin @@ -396,7 +396,6 @@ begin if FromRegistry then begin try - // Res := TResourceStream.Create(HInstance, Identifier, Format); lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); // TEmp, untill all code is moved to refactord way.. @@ -413,7 +412,9 @@ begin begin // Get the File Extension... Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - lTextureStream := TFileStream.create( Identifier , fmOpenRead or fmShareDenyNone ); + + lTextureStream := TMemoryStream.create(); + TMemoryStream(lTextureStream).loadfromfile( Identifier ); end; end; @@ -990,7 +991,9 @@ begin if Log.BenchmarkTimeLength[4] >= 1 then Log.LogBenchmark('**********> Texture Load Time Warning - ' + Format + '/' + Identifier + '/' + Typ, 4); - end; // logerror + end; // logerror + +// freeandnil( lTextureStream ); // TODO - jb - free this.. but we cant at the moment :( // {$ENDIF} end; -- cgit v1.2.3