DEADSOFTWARE

render: remove graphics data from TAnimationState
[d2df-sdl.git] / src / game / opengl / r_gfx.pas
index 91b9c38c670d5a0e64ddd4b042d2bb4e72ff3a22..79b3c2b62adf1cb753eb97af83b948eecc104ec8 100644 (file)
@@ -17,31 +17,13 @@ unit r_gfx;
 
 interface
 
+{
   const
-    R_GFX_NONE = 0;
-    R_GFX_TELEPORT = 1;
-    R_GFX_FLAME = 2;
-    R_GFX_EXPLODE_ROCKET = 3;
-    R_GFX_EXPLODE_BFG = 4;
-    R_GFX_BFG_HIT = 5;
-    R_GFX_FIRE = 6;
-    R_GFX_ITEM_RESPAWN = 7;
-    R_GFX_SMOKE = 8;
-    R_GFX_EXPLODE_SKELFIRE = 9;
-    R_GFX_EXPLODE_PLASMA = 10;
-    R_GFX_EXPLODE_BSPFIRE = 11;
-    R_GFX_EXPLODE_IMPFIRE = 12;
-    R_GFX_EXPLODE_CACOFIRE = 13;
-    R_GFX_EXPLODE_BARONFIRE = 14;
-    R_GFX_TELEPORT_FAST = 15;
-    R_GFX_SMOKE_TRANS = 16;
-    R_GFX_FLAME_RAND = 17;
-    R_GFX_LAST = 17;
-
     R_GFX_FLAME_WIDTH = 32;
     R_GFX_FLAME_HEIGHT = 32;
     R_GFX_SMOKE_WIDTH = 32;
     R_GFX_SMOKE_HEIGHT = 32;
+}
 
   procedure r_GFX_Load;
   procedure r_GFX_Free;
@@ -64,6 +46,7 @@ implementation
   type
     TOnceAnim = record
       AnimType:   Byte;
+      Alpha:      Byte;
       x, y:       Integer;
       oldX, oldY: Integer;
       Animation:  TAnimationState;
@@ -127,10 +110,11 @@ implementation
   end;
 
   procedure r_GFX_OnceAnim (AnimType, x, y: Integer);
-    var find_id: DWORD; a: TAnimationState;
+    var find_id: DWORD; a: TAnimationState; alpha: Byte;
   begin
     if not gpart_dbg_enabled then exit;
     find_id := FindOnceAnim();
+    alpha := 0;
     case AnimType of
       R_GFX_NONE: a := nil;
       R_GFX_TELEPORT: a := TAnimationState.Create(false, 6, 10); // !!! speed can be 3
@@ -155,7 +139,7 @@ implementation
       begin
         AnimType := R_GFX_SMOKE;
         a := TAnimationState.Create(false, 3, 10);
-        a.alpha := 150;
+        alpha := 150;
       end;
       R_GFX_EXPLODE_SKELFIRE: a := TAnimationState.Create(false, 8, 3);
       R_GFX_EXPLODE_PLASMA: a := TAnimationState.Create(false, 3, 4);
@@ -168,9 +152,8 @@ implementation
       assert(false)
     end;
     OnceAnims[find_id].AnimType := AnimType;
+    OnceAnims[find_id].Alpha := alpha;
     OnceAnims[find_id].Animation := a;
-//    OnceAnims[find_id].Animation.Blending := Anim.Blending;
-//    OnceAnims[find_id].Animation.alpha := Anim.alpha;
     OnceAnims[find_id].x := x;
     OnceAnims[find_id].y := y;
   end;
@@ -258,7 +241,7 @@ begin
         begin
           fx := nlerp(oldx, x, gLerpFactor);
           fy := nlerp(oldy, y, gLerpFactor);
-          r_AnimationState_Draw(gfxFrames[AnimType], Animation, x, y, TMirrorType.None);
+          r_AnimationState_Draw(gfxFrames[AnimType], Animation, x, y, Alpha, TMirrorType.None, False);
         end;
       end;
     end;