DEADSOFTWARE

render: fix animated textures
[d2df-sdl.git] / src / game / g_textures.pas
index acac0c61d3b8a87cc78bc9598d65d834ef6817c2..02fe5aad01a60530c126232a0679d05d4d87b173 100644 (file)
@@ -24,11 +24,9 @@ uses
 
 type
   TLevelTexture = record
-    textureName: AnsiString;
-    width, height: Word;
-    case anim: Boolean of
-      false: (textureID: LongWord);
-      true: (framesID: LongWord; framesCount: Byte; speed: Byte);
+    TextureName: AnsiString; // as stored in wad
+    FullName: AnsiString; // full path to texture // !!! merge it with TextureName
+    framesCount, speed: Byte;
   end;
 
   TLevelTextureArray = array of TLevelTexture;
@@ -61,7 +59,7 @@ type
     procedure saveState (st: TStream);
     procedure loadState (st: TStream);
 
-//    function totalFrames (): Integer; inline;
+    function totalFrames (): Integer; inline;
 
   public
     property played: Boolean read mPlayed;
@@ -236,6 +234,11 @@ begin
   reset
 end;
 
+function TAnimationState.totalFrames (): Integer; inline;
+begin
+  result := mLength
+end;
+
 procedure TAnimationState.saveState (st: TStream);
 begin
   if (st = nil) then exit;