anchor.diff:    end;
   
   var
  -  A: TKMAnimLoop;
     I, Step: Integer;
     pngWidth, pngHeight, newWidth, newHeight: Word;
     pngBase, pngShad, pngTeam, pngCrop, pngCropMask: TKMCardinalArray;
  
positive.code:   dirBase, dirShad, dirTeam, suffixPath: string;
    needsMask: Boolean;
  begin
    if aDir = dirNA then
      Exit(-1);
  
    A := fResUnits[aUT].UnitAnim[aAction,aDir];
  
    if (A.Count <= 1) or (A.Step[1] = -1) or not (aAction in UNIT_SUPPORTED_ANIMS[aUT]) then
      Exit(-1);
  
    for I := Low(fAnimCache) to High(fAnimCache) do
    begin
      if SameAnim(fAnimCache[I].A, A) then
  
negative.code: 
  
  function TForm1.DoInterpUnit(aUT: TKMUnitType; aAction: TKMUnitActionType; aDir: TKMDirection; var aPicOffset: Integer): Integer;
  var
    A: TKMAnimLoop;
    bkgRGB: Cardinal;
  begin
    if aDir = dirNA then
      Exit(-1);
  
    A := fResUnits[aUT].UnitAnim[aAction,aDir];
  
    if (A.Count <= 1) or (A.Step[1] = -1) or not (aAction in UNIT_SUPPORTED_ANIMS[aUT]) then
      Exit(-1);
  
    //Death animations have semi-transparent white that we treat as shadows
    if aAction = uaDie then
      bkgRGB := $FFFFFF
    else
      bkgRGB := $000000;
  
    DoInterp(rxUnits, A, bkgRGB, aPicOffset);
  end;
  
  
  function TForm1.DoInterp(RT: TRXType; A: TKMAnimLoop; aBkgRGB: Cardinal; var aPicOffset: Integer): Integer;
  
    function SameAnim(A, B: TKMAnimLoop): Boolean;
    var
  