DEADSOFTWARE

player: use TAnimState for punch
[d2df-sdl.git] / src / game / opengl / r_animations.pas
index f50ce92b382b21cb5868c22fb12d96f88226205b..6e02aec1ed0c9c95aed1c832ec194b6261ca3b69 100644 (file)
@@ -22,6 +22,9 @@ interface
   procedure r_AnimationState_Draw (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
   procedure r_AnimationState_DrawEx (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean; rpoint: TDFPoint; angle: SmallInt);
 
+  procedure r_AnimState_Draw (FID: DWORD; const t: TAnimState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
+  procedure r_AnimState_DrawEx (FID: DWORD; const t: TAnimState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean; rpoint: TDFPoint; angle: SmallInt);
+
   function g_CreateFramesImg (ia: TDynImageDataArray; ID: PDWORD; const Name: AnsiString; BackAnimation: Boolean = false): Boolean;
 
   function g_Frames_CreateWAD (ID: PDWORD; const Name, Resource: AnsiString; mWidth, mHeight, mCount: Word; BackAnimation: Boolean=false): Boolean;
@@ -30,6 +33,7 @@ interface
   function g_Frames_Dup (const NewName, OldName: AnsiString): Boolean;
   function g_Frames_Get (out ID: LongWord; const FramesName: AnsiString): Boolean;
   function g_Frames_GetTexture (out ID: LongWord; const FramesName: AnsiString; Frame: Word): Boolean;
+  procedure g_Frames_GetFrameSize (ID: DWORD; out w, h: Integer);
   function g_Frames_Exists (const FramesName: AnsiString): Boolean;
   procedure g_Frames_DeleteByName (const FramesName: AnsiString);
   procedure g_Frames_DeleteByID (ID: LongWord);
@@ -56,6 +60,17 @@ implementation
     g_language, g_game
   ;
 
+  procedure g_Frames_GetFrameSize (ID: DWORD; out w, h: Integer);
+  begin
+    w := 0;
+    h := 0;
+    if framesArray <> nil then
+    begin
+      w := framesArray[ID].frameWidth;
+      h := framesArray[ID].frameHeight;
+    end
+  end;
+
   procedure r_AnimationState_Draw (FID: DWORD; t: TAnimationState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
   begin
     if t.enabled then
@@ -68,6 +83,18 @@ implementation
       e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, alpha, true, blending, angle, @rpoint, mirror)
   end;
 
+  procedure r_AnimState_Draw (FID: DWORD; const t: TAnimState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean);
+  begin
+    if t.enabled then
+      e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, alpha, true, blending, 0, nil, mirror)
+  end;
+
+  procedure r_AnimState_DrawEx (FID: DWORD; const t: TAnimState; x, y: Integer; alpha: Byte; mirror: TMirrorType; blending: Boolean; rpoint: TDFPoint; angle: SmallInt);
+  begin
+    if t.enabled then
+      e_DrawAdv(framesArray[FID].TexturesID[t.currentFrame], x, y, alpha, true, blending, angle, @rpoint, mirror)
+  end;
+
 function allocFrameSlot (): LongWord;
 var
   f: integer;