From 7e01085a1981f28e538b06bff5cebf2b88c975af Mon Sep 17 00:00:00 2001 From: jaybinks Date: Thu, 20 Sep 2007 11:20:20 +0000 Subject: fixed nasty bug I introduced... sorry.. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@419 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/TextGL.pas | 2 ++ Game/Code/Classes/UTexture.pas | 23 ++++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'Game/Code') diff --git a/Game/Code/Classes/TextGL.pas b/Game/Code/Classes/TextGL.pas index ee1a74f3..1e4a9f6a 100644 --- a/Game/Code/Classes/TextGL.pas +++ b/Game/Code/Classes/TextGL.pas @@ -79,6 +79,8 @@ 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/UTexture.pas b/Game/Code/Classes/UTexture.pas index e7038e78..96c0ec28 100644 --- a/Game/Code/Classes/UTexture.pas +++ b/Game/Code/Classes/UTexture.pas @@ -316,6 +316,8 @@ function TTextureUnit.LoadBitmap( aSourceStream : TStream; aIMG : TBitMap ): boo begin result := false; try + Log.LogStatus( ' TTextureUnit.LoadBitmap' , '' ); + aSourceStream.position := 0; aIMG.LoadFromStream( aSourceStream ); finally @@ -329,6 +331,8 @@ var begin result := false; try + Log.LogStatus( ' TTextureUnit.LoadJpeg' , ''); + aSourceStream.position := 0; TextureJ := TJPEGImage.Create; @@ -375,6 +379,7 @@ var lTextureStream : TStream; begin + lTextureStream := nil; Log.LogStatus( 'From Resource - ' + inttostr( integer( FromRegistry ) ) , Identifier +' '+ Format +' '+ Typ ); // {$IFNDEF FPC} @@ -390,9 +395,13 @@ begin if FromRegistry then begin try -// Res := TResourceStream.Create(HInstance, Identifier, Format); + + Log.LogStatus( ' A' , ''); + + // Res := TResourceStream.Create(HInstance, Identifier, Format); lTextureStream := TResourceStream.Create(HInstance, Identifier, Format); - + Log.LogStatus( ' B' , ''); + // TODO : Where does the format come from except Log.LogStatus( 'ERROR Could not load from resource' , Identifier +' '+ Format +' '+ Typ ); @@ -406,13 +415,17 @@ begin begin // Get the File Extension... Format := PAnsichar(UpperCase(RightStr(ExtractFileExt(Identifier),3))); - lTextureStream := TFileStream.create( Identifier , fmOpenRead ); + lTextureStream := TFileStream.create( Identifier , fmOpenRead or fmShareDenyNone ); end; end; -// if FromRegistry or -// ((not FromRegistry) and FileExists(Identifier)) then + if assigned( lTextureStream ) then begin + Log.LogStatus( ' C - '+Format , ''); + + // TEmp, untill all code is moved to refactord way.. + Res := TResourceStream( lTextureStream ); + TextureB := TBitmap.Create; if Format = 'BMP' then -- cgit v1.2.3