From 442a04f5de7ff8d8dd302f1b46685d4f23866ec7 Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Wed, 13 Apr 2022 20:47:33 +0300 Subject: [PATCH] render: draw flag anims using TAnimState --- src/game/opengl/r_map.pas | 9 ++++----- src/game/opengl/r_playermodel.pas | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/game/opengl/r_map.pas b/src/game/opengl/r_map.pas index 2ec57d4..a2f3d18 100644 --- a/src/game/opengl/r_map.pas +++ b/src/game/opengl/r_map.pas @@ -55,17 +55,16 @@ implementation Anim: Boolean; end; FlagFrames: array [FLAG_RED..FLAG_BLUE] of DWORD; - FlagAnim: TAnimationState; + FlagAnim: TAnimState; procedure r_Map_Initialize; begin - FlagAnim := TAnimationState.Create(True, 8, 5); + FlagAnim := TAnimState.Create(True, 8, 5); end; procedure r_Map_Finalize; begin - FlagAnim.Free; - FlagAnim := nil; + FlagAnim.Invalidate; end; procedure r_Map_Load; @@ -264,7 +263,7 @@ end; else Mirror := TMirrorType.None; dx := IfThen(f.Direction = TDirection.D_LEFT, -1, +1); - r_AnimationState_Draw(FlagFrames[i], FlagAnim, tx + dx, ty + 1, 0, Mirror, False); + r_AnimState_Draw(FlagFrames[i], FlagAnim, tx + dx, ty + 1, 0, Mirror, False); if g_debug_Frames then e_DrawQuad(tx + f.Obj.Rect.X, ty + f.Obj.Rect.Y, tx + f.Obj.Rect.X + f.Obj.Rect.Width - 1, ty + f.Obj.Rect.Y + f.Obj.Rect.Height - 1, 0, 255, 0) end diff --git a/src/game/opengl/r_playermodel.pas b/src/game/opengl/r_playermodel.pas index cc10d12..b62e321 100644 --- a/src/game/opengl/r_playermodel.pas +++ b/src/game/opengl/r_playermodel.pas @@ -68,7 +68,7 @@ implementation end; RedFlagFrames: DWORD; BlueFlagFrames: DWORD; - FlagAnimState: TAnimationState; + FlagAnimState: TAnimState; {$IFDEF ENABLE_GIBS} function r_PlayerModel_GetGibRect (m, id: Integer): TRectWH; @@ -79,13 +79,12 @@ implementation procedure r_PlayerModel_Initialize; begin - FlagAnimState := TAnimationState.Create(True, 8, 5); + FlagAnimState := TAnimState.Create(True, 8, 5); end; procedure r_PlayerModel_Finalize; begin - FlagAnimState.Free; - FlagAnimState := nil; + FlagAnimState.Invalidate; end; procedure ExtAnimFromBaseAnim(MName: String; AIdx: Integer); @@ -325,7 +324,7 @@ begin fa := PlayerModelsArray[pm.id].FlagAngle; p.X := IfThen(pm.Direction = TDirection.D_LEFT, FLAG_BASEPOINT.X, 64 - FLAG_BASEPOINT.X); p.Y := FLAG_BASEPOINT.Y; - r_AnimationState_DrawEx( + r_AnimState_DrawEx( FramesID, FlagAnimState, X + IfThen(pm.Direction = TDirection.D_LEFT, fp.X - 1, 2 * FLAG_BASEPOINT.X - fp.X + 1) - FLAG_BASEPOINT.X, -- 2.29.2