aboutsummaryrefslogtreecommitdiffstats
path: root/Game
diff options
context:
space:
mode:
Diffstat (limited to 'Game')
-rw-r--r--Game/Code/Classes/UTexture.pas132
-rw-r--r--Game/Code/Classes/UVideo.pas61
2 files changed, 98 insertions, 95 deletions
diff --git a/Game/Code/Classes/UTexture.pas b/Game/Code/Classes/UTexture.pas
index 56b8ac79..1f5f6e0a 100644
--- a/Game/Code/Classes/UTexture.pas
+++ b/Game/Code/Classes/UTexture.pas
@@ -93,26 +93,26 @@ type
procedure FitTexture(var TexSurface: PSDL_Surface; W,H: Cardinal);
procedure ColorizeTexture(TexSurface: PSDL_Surface; Col: Cardinal);
public
- Limit: integer;
- CreateCacheMipmap: boolean;
-
-// function GetNumberFor
- function GetTexture(const Name: string; Typ: TTextureType; FromCache: boolean = true): TTexture; overload;
- function GetTexture(const Name: string; Typ: TTextureType; Col: LongWord; FromCache: boolean = true): TTexture; overload;
- function FindTexture(const Name: string; Typ: TTextureType; Col: Cardinal): integer;
- function LoadTexture(FromRegistry: boolean; const Identifier: string; Typ: TTextureType; Col: LongWord): TTexture; overload;
- function LoadTexture(const Identifier: string; Typ: TTextureType; Col: LongWord): TTexture; overload;
- function LoadTexture(const Identifier: string): TTexture; overload;
- function CreateTexture(var Data: array of byte; const Name: string; W, H: word; Bits: byte): TTexture;
- procedure UnloadTexture(const Name: string; Typ: TTextureType; FromCache: boolean); overload;
- procedure UnloadTexture(const Name: string; Typ: TTextureType; Col: Cardinal; FromCache: boolean); overload;
- //procedure FlushTextureDatabase();
-
- Function GetCoverThumbnail(const Name: string): Pointer;
- Procedure SetCoverSize(W, H: Integer);
-
- Constructor Create;
- Destructor Destroy; override;
+ Limit: integer;
+ CreateCacheMipmap: boolean;
+
+ //function GetNumberFor
+ function GetTexture(const Name: string; Typ: TTextureType; FromCache: boolean = true): TTexture; overload;
+ function GetTexture(const Name: string; Typ: TTextureType; Col: LongWord; FromCache: boolean = true): TTexture; overload;
+ function FindTexture(const Name: string; Typ: TTextureType; Col: Cardinal): integer;
+ function LoadTexture(FromRegistry: boolean; const Identifier: string; Typ: TTextureType; Col: LongWord): TTexture; overload;
+ function LoadTexture(const Identifier: string; Typ: TTextureType; Col: LongWord): TTexture; overload;
+ function LoadTexture(const Identifier: string): TTexture; overload;
+ function CreateTexture(var Data: array of byte; const Name: string; W, H: word; Bits: byte): TTexture;
+ procedure UnloadTexture(const Name: string; Typ: TTextureType; FromCache: boolean); overload;
+ procedure UnloadTexture(const Name: string; Typ: TTextureType; Col: Cardinal; FromCache: boolean); overload;
+ //procedure FlushTextureDatabase();
+
+ Function GetCoverThumbnail(const Name: string): Pointer;
+ Procedure SetCoverSize(W, H: Integer);
+
+ Constructor Create;
+ Destructor Destroy; override;
end;
var
@@ -349,16 +349,11 @@ var
begin
Log.BenchmarkStart(4);
Mipmapping := true;
-(*
- Log.LogStatus( '', '' );
- if Identifier = nil then
- Log.LogStatus(' ERROR unknown Identifier', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''')
- else
- Log.LogStatus(' should be ok - trying to load', 'Id:'''+Identifier+''' Fmt:'''+Format+''' Typ:'''+Typ+'''');
-*)
+ // zero texture data
+ FillChar(Result, SizeOf(Result), 0);
- // load texture data into memory
+ // load texture data into memory
{$ifdef blindydebug}
Log.LogStatus('',' ----------------------------------------------------');
Log.LogStatus('',' LoadImage('''+Identifier+''') (called by '+Format+')');
@@ -408,40 +403,41 @@ begin
{$endif}
+ (*
// don't actually understand, if this is needed...
// this should definately be changed... together with all this
// cover cache stuff
- {if (CreateCacheMipmap) and (Typ = TEXTURE_TYPE_PLAIN) then
+ if (CreateCacheMipmap) and (Typ = TEXTURE_TYPE_PLAIN) then
begin
- {$ifdef blindydebug}{
+ {$ifdef blindydebug}
Log.LogStatus('',' JB-1 : Minimap');
{$endif}
- {if (TnWidth <= 256) and (TnHeight <= 256) then
+ if (TnWidth <= 256) and (TnHeight <= 256) then
begin
- {$ifdef blindydebug}{
+ {$ifdef blindydebug}
Log.LogStatus('',' GetScaledTexture('''+inttostr(Covers.W)+''','''+inttostr(Covers.H)+''') (for CacheMipmap)');
- {$endif}{
+ {$endif}
MipmapSurface:=GetScaledTexture(TexSurface, TnWidth, TnHeight);
if assigned(MipmapSurface) then
begin
- {$ifdef blindydebug}{
+ {$ifdef blindydebug}
Log.LogStatus('',' ok');
Log.LogStatus('',' BlitSurface Stuff');
- {$endif}{
+ {$endif}
// creating and freeing the surface could be done once, if Cover.W and Cover.H don't change
TnSurface:=SDL_CreateRGBSurfaceFrom(@TnBuffer[0], TnWidth, TnHeight, 24, TnWidth*3, $000000ff, $0000ff00, $00ff0000, 0);
SDL_BlitSurface(TnSurface, nil, TnSurface, nil);
SDL_FreeSurface(TnSurface);
- {$ifdef blindydebug}{
+ {$ifdef blindydebug}
Log.LogStatus('',' ok');
Log.LogStatus('',' SDL_FreeSurface (CacheMipmap)');
- {$endif}{
+ {$endif}
SDL_FreeSurface(TnSurface);
- {$ifdef blindydebug}{
+ {$ifdef blindydebug}
Log.LogStatus('',' ok');
- {$endif}{
+ {$endif}
end
else
begin
@@ -449,7 +445,9 @@ begin
end;
end;
// should i create a cache texture, if Covers.W/H are larger?
- end; }
+ end;
+
+ *)
{$ifdef blindydebug}
Log.LogStatus('',' JB-2');
@@ -507,36 +505,40 @@ begin
{$endif}
- Result.X := 0;
- Result.Y := 0;
- Result.Z := 0;
- Result.W := 0;
- Result.H := 0;
- Result.ScaleW := 1;
- Result.ScaleH := 1;
- Result.Rot := 0;
- Result.TexNum := ActTex;
- Result.TexW := oldWidth / newWidth;
- Result.TexH := oldHeight / newHeight;
-
- Result.Int := 1;
- Result.ColR := 1;
- Result.ColG := 1;
- Result.ColB := 1;
- Result.Alpha := 1;
-
- // new test - default use whole texure, taking TexW and TexH as const and changing these
- Result.TexX1 := 0;
- Result.TexY1 := 0;
- Result.TexX2 := 1;
- Result.TexY2 := 1;
+ // setup texture struct
+ with Result do
+ begin
+ X := 0;
+ Y := 0;
+ Z := 0;
+ W := 0;
+ H := 0;
+ ScaleW := 1;
+ ScaleH := 1;
+ Rot := 0;
+ TexNum := ActTex;
+ TexW := oldWidth / newWidth;
+ TexH := oldHeight / newHeight;
+
+ Int := 1;
+ ColR := 1;
+ ColG := 1;
+ ColB := 1;
+ Alpha := 1;
+
+ // new test - default use whole texure, taking TexW and TexH as const and changing these
+ TexX1 := 0;
+ TexY1 := 0;
+ TexX2 := 1;
+ TexY2 := 1;
+
+ Name := Identifier;
+ end;
{$ifdef blindydebug}
Log.LogStatus('',' JB-6');
{$endif}
- Result.Name := Identifier;
-
SDL_FreeSurface(TexSurface);
{$ifdef blindydebug}
diff --git a/Game/Code/Classes/UVideo.pas b/Game/Code/Classes/UVideo.pas
index fbe3ec32..d29b713b 100644
--- a/Game/Code/Classes/UVideo.pas
+++ b/Game/Code/Classes/UVideo.pas
@@ -47,6 +47,7 @@ uses
{$ENDIF}
math,
gl,
+ glext,
SysUtils,
UCommon,
UConfig,
@@ -255,36 +256,36 @@ begin
if (errnum < 0) then
begin
// failed to read a frame, check reason
-
- {$IF (LIBAVFORMAT_VERSION_MAJOR >= 52)}
- pbIOCtx := VideoFormatContext^.pb;
- {$ELSE}
- pbIOCtx := @VideoFormatContext^.pb;
- {$IFEND}
-
- // check for end-of-file (eof is not an error)
- if (url_feof(pbIOCtx) <> 0) then
- begin
- EOF := true;
- Exit;
- end;
-
- // check for errors
- if (url_ferror(pbIOCtx) <> 0) then
- Exit;
-
+
+ {$IF (LIBAVFORMAT_VERSION_MAJOR >= 52)}
+ pbIOCtx := VideoFormatContext^.pb;
+ {$ELSE}
+ pbIOCtx := @VideoFormatContext^.pb;
+ {$IFEND}
+
+ // check for end-of-file (eof is not an error)
+ if (url_feof(pbIOCtx) <> 0) then
+ begin
+ EOF := true;
+ Exit;
+ end;
+
+ // check for errors
+ if (url_ferror(pbIOCtx) <> 0) then
+ Exit;
+
// url_feof() does not detect an EOF for some mov-files (e.g. deluxe.mov)
// so we have to do it this way.
if ((VideoFormatContext^.file_size <> 0) and
(pbIOCtx^.pos >= VideoFormatContext^.file_size)) then
begin
EOF := true;
- Exit;
+ Exit;
end;
// no error -> wait for user input
- SDL_Delay(100);
- continue;
+ SDL_Delay(100);
+ continue;
end;
// if we got a packet from the video stream, then decode it
@@ -654,15 +655,15 @@ begin
end;
// set debug options
- VideoCodecContext^.debug_mv := 0;
- VideoCodecContext^.debug := 0;
-
- // detect bug-workarounds automatically
- VideoCodecContext^.workaround_bugs := FF_BUG_AUTODETECT;
- // error resilience strategy (careful/compliant/agressive/very_aggressive)
- //VideoCodecContext^.error_resilience := FF_ER_CAREFUL; //FF_ER_COMPLIANT;
- // allow non spec compliant speedup tricks.
- //VideoCodecContext^.flags2 := VideoCodecContext^.flags2 or CODEC_FLAG2_FAST;
+ VideoCodecContext^.debug_mv := 0;
+ VideoCodecContext^.debug := 0;
+
+ // detect bug-workarounds automatically
+ VideoCodecContext^.workaround_bugs := FF_BUG_AUTODETECT;
+ // error resilience strategy (careful/compliant/agressive/very_aggressive)
+ //VideoCodecContext^.error_resilience := FF_ER_CAREFUL; //FF_ER_COMPLIANT;
+ // allow non spec compliant speedup tricks.
+ //VideoCodecContext^.flags2 := VideoCodecContext^.flags2 or CODEC_FLAG2_FAST;
errnum := avcodec_open(VideoCodecContext, VideoCodec);
if (errnum < 0) then